A RetroSearch Logo

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

Search Query:

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

[Python-Dev] bytes

[Python-Dev] bytes / unicodeStephen J. Turnbull stephen at xemacs.org
Sat Jun 26 05:42:25 CEST 2010
P.J. Eby writes:

 > it's just that if you already have the bytes, and all you want to
 > do is tag them (e.g. the WSGI headers case), the extra encoding
 > step seems pointless.

Well, I'll have to concede that unless and until I get involved in the
WSGI development effort.<wink>

 > >But with your architecture, it seems to me that you actually don't
 > >want polymorphic functions in the stdlib.  You want the stdlib
 > >functions to be bytes-oriented if and only if they are reliable.  (This
 > >is what I was saying to Guido elsewhere.)
 > 
 > I'm not sure I follow you.

What I'm saying here is that if bytes are the signal of validity, and
the stdlib functions preserve validity, then it's better to have the
stdlib functions object to unicode data as an argument.  Compare the
alternative: it returns a unicode object which might get passed around
for a while before one of your functions receives it and identifies it
as unvalidated data.

But you agree that there are better mechanisms for validation
(although not available in Python yet), so I don't see this as an
potential obstacle to polymorphism now.

 > What I want is for the stdlib to create stringlike objects of a
 > type determined by the types of the inputs --

In general this is a hard problem, though.  Polymorphism, OK, one-way
tainting OK, but in general combining related types is pretty
arbitrary, and as in the encoded-bytes case, the result type often
varies depending on expectations of callers, not the types of the
data.
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