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.
On Tue, Apr 15, 2008 at 7:18 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Yeah, practicalibty beat purity on that one. I'd say let it beat > purity on int() and float() as well. > > On Tue, Apr 15, 2008 at 2:42 AM, Nick Coghlan <[EMAIL PROTECTED]> wrote: > > Mark Dickinson wrote: > > > On the other hand, there's at least some sense in which bytes already > > > acts as a sort of poor-man's string: witness bytes.lower and friends. > > > Maybe practicality beats purity here? > > > > From PEP 358 (describing what is now bytearray): > > > > """Note the conspicuous absence of .isupper(), .upper(), and friends. > > (But see "Open Issues" below.) There is no .__hash__() because > > the object is mutable.""" > > > > And the open issue: > > > > """A case could even be made for supporting .islower(), .isupper(), > > .isspace(), .isalpha(), .isalnum(), .isdigit() and the > > corresponding conversions (.lower() etc.), using the ASCII > > definitions for letters, digits and whitespace. If this is > > accepted, the cases for .ljust(), .rjust(), .center() and > > .split() become much stronger, and they should have default > > arguments as well, using an ASCII space or all ASCII whitespace > > (for .split()).""" > > > > PEP 3157 resolved that open issue as follows: > > > > """This is exactly the set of methods present on the str type in Python > > 2.x, with the exclusion of .encode(). The signatures and semantics are > > the same too. However, whenever character classes like letter, > > whitespace, lower case are used, the ASCII definitions of these classes > > are used.""" > > > > > > That seems fairly explicit to me in saying that a bytes or bytearray > > object should be considered to be ASCII encoded when treated as a > string. > > > > Cheers, > > Nick. > > > > -- > > Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia > > --------------------------------------------------------------- > > http://www.boredomandlaziness.org > > > > > > _______________________________________________ > > Python-3000 mailing list > > Python-3000@python.org > > http://mail.python.org/mailman/listinfo/python-3000 > > Unsubscribe: > http://mail.python.org/mailman/options/python-3000/guido%40python.org > > > > > > -- > --Guido van Rossum (home page: > http://www.python.org/~guido/<http://www.python.org/%7Eguido/> > ) > _______________________________________________ > Python-3000 mailing list > Python-3000@python.org > http://mail.python.org/mailman/listinfo/python-3000 > Unsubscribe: > http://mail.python.org/mailman/options/python-3000/greg%40krypto.org >
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com