Agreed. Otherwise the common ascii based network protocol task of reading some bytes in and converting them to the integer that they represent in ascii would require an additional unicode decoding step.<br><br><div class="gmail_quote">
On Tue, Apr 15, 2008 at 7:18 AM, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Yeah, practicalibty beat purity on that one. I'd say let it beat<br>
purity on int() and float() as well.<br>
<div><div></div><div class="Wj3C7c"><br>
On Tue, Apr 15, 2008 at 2:42 AM, Nick Coghlan <<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>> wrote:<br>
> Mark Dickinson wrote:<br>
> > On the other hand, there's at least some sense in which bytes already<br>
> > acts as a sort of poor-man's string: witness bytes.lower and friends.<br>
> > Maybe practicality beats purity here?<br>
><br>
> From PEP 358 (describing what is now bytearray):<br>
><br>
> """Note the conspicuous absence of .isupper(), .upper(), and friends.<br>
> (But see "Open Issues" below.) There is no .__hash__() because<br>
> the object is mutable."""<br>
><br>
> And the open issue:<br>
><br>
> """A case could even be made for supporting .islower(), .isupper(),<br>
> .isspace(), .isalpha(), .isalnum(), .isdigit() and the<br>
> corresponding conversions (.lower() etc.), using the ASCII<br>
> definitions for letters, digits and whitespace. If this is<br>
> accepted, the cases for .ljust(), .rjust(), .center() and<br>
> .split() become much stronger, and they should have default<br>
> arguments as well, using an ASCII space or all ASCII whitespace<br>
> (for .split())."""<br>
><br>
> PEP 3157 resolved that open issue as follows:<br>
><br>
> """This is exactly the set of methods present on the str type in Python<br>
> 2.x, with the exclusion of .encode(). The signatures and semantics are<br>
> the same too. However, whenever character classes like letter,<br>
> whitespace, lower case are used, the ASCII definitions of these classes<br>
> are used."""<br>
><br>
><br>
> That seems fairly explicit to me in saying that a bytes or bytearray<br>
> object should be considered to be ASCII encoded when treated as a string.<br>
><br>
> Cheers,<br>
> Nick.<br>
><br>
> --<br>
> Nick Coghlan | <a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a> | Brisbane, Australia<br>
> ---------------------------------------------------------------<br>
> <a href="http://www.boredomandlaziness.org" target="_blank">http://www.boredomandlaziness.org</a><br>
><br>
><br>
> _______________________________________________<br>
> Python-3000 mailing list<br>
> <a href="mailto:Python-3000@python.org">Python-3000@python.org</a><br>
> <a href="http://mail.python.org/mailman/listinfo/python-3000" target="_blank">http://mail.python.org/mailman/listinfo/python-3000</a><br>
</div></div>> Unsubscribe: <a href="http://mail.python.org/mailman/options/python-3000/guido%40python.org" target="_blank">http://mail.python.org/mailman/options/python-3000/guido%40python.org</a><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
--Guido van Rossum (home page: <a href="http://www.python.org/%7Eguido/" target="_blank">http://www.python.org/~guido/</a>)<br>
</font><div><div></div><div class="Wj3C7c">_______________________________________________<br>
Python-3000 mailing list<br>
<a href="mailto:Python-3000@python.org">Python-3000@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-3000" target="_blank">http://mail.python.org/mailman/listinfo/python-3000</a><br>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-3000/greg%40krypto.org" target="_blank">http://mail.python.org/mailman/options/python-3000/greg%40krypto.org</a><br>
</div></div></blockquote></div><br>