On Apr 22, 2013, at 10:04 PM, Steven D'Aprano <st...@pearwood.info> wrote:

> On 23/04/13 09:16, Greg Ewing wrote:
>> Victor Stinner wrote:
>>> The last proposition is to add transform() and untransform() methods
>>> to bytes and str types. ... If I remember
>>> correctly, the missing point is how to define which types are
>>> supported by a codec
>> 
>> Also, for any given codec, which direction is "transform"
>> and which is "untransform"?
>> 
>> Also also, what's so special about base64 et al that they
>> deserve an ultra-special way of invoking them, instead of
>> having to import a class or function like you do for
>> *every* *other* piece of library functionality?
> 
> 
> As others have pointed out in the past, repeatedly, the codec system is 
> completely general and can transform bytes->bytes and text->text just as 
> easily as bytes<->text. Or indeed any bijection, as the docs for 2.7 point 
> out. The question isn't "What's so special about base64?" The questions 
> should be:
> 
> - What's so special about exotic legacy transformations like ISO-8859-10 and 
> MacRoman that they deserve a string method for invoking them?
> 
> - Why have common transformations like base64, which worked in 2.x, been 
> relegated to second-class status in 3.x?
> 
> - If it is no burden to have to import a module and call an external function 
> for some transformations, why have encode and decode methods at all?
> 
> 
> If you haven't read this, you should:
> 
> http://lucumr.pocoo.org/2012/8/11/codec-confusion/

I may be dull, but it wasn't until I started using Python 3 that it really 
clicked in my head what encode/decode did exactly. In Python2 I just sort of 
sprinkled one or the other when there was errors until the pain stopped. I 
mostly attribute this to str.decode and bytes.encode not existing.

> 
> 
> 
> 
> -- 
> Steven
> _______________________________________________
> 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/donald%40stufft.io


-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
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

Reply via email to