[Python-Dev] Decoder functions accept str in py3k
M.-A. Lemburg
mal at egenix.com
Wed Jan 7 19:26:38 CET 2009
On 2009-01-07 16:34, Guido van Rossum wrote:
> Sounds like yet another remnant of the old philosophy, which indeed
> supported encode and decode operations on both string types. :-(
No, that's something I explicitly readded to Python 3k, since the
codecs interface is independent of the input and output types (the
codecs decide which combinations to support).
The bytes and Unicode *methods* do guarantee that you get either
Unicode or bytes as output.
> On Wed, Jan 7, 2009 at 5:39 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>> Hello,
>>
>> I've just noticed that in py3k, the decoding functions in the codecs module
>> accept str objects as well as bytes:
>>
>> # import codecs
>> # c = codecs.getdecoder('utf8')
>> # c('aa')
>> ('aa', 2)
>> # c('éé')
>> ('éé', 4)
>> # c = codecs.getdecoder('latin1')
>> # c('aa')
>> ('aa', 2)
>> # c('éé')
>> ('Ã(c)Ã(c)', 4)
>>
>> Is it a bug?
>>
>> Regards
>>
>> Antoine.
>>
>>
>> _______________________________________________
>> Python-Dev mailing list
>> Python-Dev at python.org
>> http://mail.python.org/mailman/listinfo/python-dev
>> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>>
>
>
>
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Jan 07 2009)
>>> 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 our new mxODBC.Connect Python Database Interface for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/
More information about the Python-Dev
mailing list