On Thu, 10 Jun 2010 12:27:33 +0200, Baptiste Carvello <baptiste...@free.fr> wrote: > Victor Stinner wrote: > > > 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 sc= > ratch = > > 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!
+1 Consistency in interface is more important in *this* context than the sensibleness of any particular transform. -- R. David Murray www.bitdance.com _______________________________________________ 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