James Y Knight wrote: > Kill the encoding argument, and you're left with: > > Python2.X: > - bytes(bytes_object) -> copy constructor > - bytes(str_object) -> copy the bytes from the str to the bytes object > - bytes(sequence_of_ints) -> make bytes with the values of the ints, > error on overflow > > Python3.X removes str, and most APIs that did return str return bytes > instead. Now all you have is: > - bytes(bytes_object) -> copy constructor > - bytes(sequence_of_ints) -> make bytes with the values of the ints, > error on overflow > > Nice and simple.
Albeit, too simple. The above approach would basically remove the possibility to easily create bytes() from literals in Py3k, since literals in Py3k create Unicode objects, e.g. bytes("123") would not work in Py3k. It's hard to imagine how you'd provide a decent upgrade path for bytes() if you introduce the above semantics in Py2.x. People would start writing bytes("123") in Py2.x and expect it to also work in Py3k, which it wouldn't. To prevent this, you'd have to outrule bytes() construction from strings altogether, which doesn't look like a viable option either. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 14 2006) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com