A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-June/100560.html below:

[Python-Dev] Reintroduce or drop completly hex, bz2, rot13, ... codecs

[Python-Dev] Reintroduce or drop completly hex, bz2, rot13, ... codecsBaptiste Carvello baptiste13z at free.fr
Thu Jun 10 12:27:33 CEST 2010
Victor Stinner a écrit :
> 
> I suppose that each codec will have a different list of accepted input and 
> output types. Example:
> 
>    bz2: encode:bytes->bytes, decode:bytes->bytes
>    rot13: encode:str->str, decode:str->str
>    hex: encode:bytes->str, decode: str->bytes 

A user point of view: please NO.

This might be more consistent with the semantics, but it forces users to scratch 
their head each time to find out which types are involved. I'd rather all 
methods take and return the same types, independant of codec, that is:

.encode : str->bytes
.decode : bytes->str
.(un)transform : same type, str->str or bytes->bytes

All other uses can be trivially done with .encode('ascii')/.decode('ascii'). 
Changing the type of *ascii* text is easy, understanding bytes vs str semantics 
is not!

Cheers,
B.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4