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/100939.html below:

[Python-Dev] bytes

[Python-Dev] bytes / unicode [Python-Dev] bytes / unicodeP.J. Eby pje at telecommunity.com
Wed Jun 23 01:55:11 CEST 2010
At 07:41 AM 6/23/2010 +1000, Nick Coghlan wrote:
>Then my example above could be made polymorphic (for ASCII compatible
>encodings) by writing:
>
>   [x for x in seq if x.endswith(x.coerce("b"))]
>
>I'm trying to see downsides to this idea, and I'm not really seeing
>any (well, other than 2.7 being almost out the door and the fact we'd
>have to grant ourselves an exception to the language moratorium)

Notice, however, that if multi-string operations used a coercion 
protocol (they currently have to do type checks already for 
byte/unicode mixes), then you could make the entire stdlib 
polymorphic by default, even for other kinds of strings that don't exist yet.

If you invent a new numeric type, generally speaking you can pass it 
to existing stdlib functions taking numbers, as long as it implements 
the appropriate protocols.  Why not do the same for strings?

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