[Python-Dev] Decoder functions accept str in py3k (original) (raw)
Guido van Rossum guido at python.org
Wed Jan 7 20:29:37 CET 2009
- Previous message: [Python-Dev] Fixing incorrect indentations in C files (Decoder functions accept str in py3k)
- Next message: [Python-Dev] Decoder functions accept str in py3k
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
OK, ignore my previous comment. Sounds like the inidividual codecs need to tighten their type checking though -- perhaps that can be fixed in 3.0.1? I really don't see why any codec used to convert between text and bytes should support its output type as input.
--Guido
On Wed, Jan 7, 2009 at 10:26 AM, M.-A. Lemburg <mal at egenix.com> wrote:
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/
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Fixing incorrect indentations in C files (Decoder functions accept str in py3k)
- Next message: [Python-Dev] Decoder functions accept str in py3k
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]