[Python-Dev] bytes / unicode

Guido van Rossum guido at python.org
Thu Jun 24 16:33:42 CEST 2010


On Thu, Jun 24, 2010 at 1:12 AM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Guido van Rossum writes:
>
>  > For example: how we can make the suite of functions used for URL
>  > processing more polymorphic, so that each developer can choose for
>  > herself how URLs need to be treated in her application.
>
> While you have come down on the side of polymorphism (as opposed to
> separate functions), I'm a little nervous about it.  Specifically,
> Philip Eby expressed a desire for earlier type errors, while
> polymorphism seems to ensure that you'll need to Look Before You Leap
> to get early error detection.

Understood, but both the majority of str/bytes methods and several
existing APIs (e.g. many in the os module, like os.listdir()) do it
this way.

Also, IMO a polymorphic function should *not* accept *mixed*
bytes/text input -- join('x', b'y') should be rejected. But join('x',
'y') -> 'x/y' and join(b'x', b'y') -> b'x/y' make sense to me.

So, actually, I *don't* understand what you mean by needing LBYL.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list