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/2004-August/048248.html below:

[Python-Dev] Re: PEP 292 - Simpler String Substitutions

[Python-Dev] Re: PEP 292 - Simpler String Substitutions [Python-Dev] Re: PEP 292 - Simpler String SubstitutionsRaymond Hettinger python at rcn.com
Mon Aug 23 18:54:33 CEST 2004
> This code-snippet is littered everwhere in my applications:
> 
>     string.join([str(x) for x in iterable])
> 
> Its tedious and makes code hard to read.  Do we need a PEP to fix
this?

A PEP would be overkill.

Still, it would be helpful to do PEP-like things such as reference
implementation, soliticing comments, keep an issue list, etc.

A minor issue is that the implementation automatically shifts to Unicode
upon encountering a Unicode string.  So you would need to test for this
before coercing to a string.

Also, join works in multiple passes.  The proposal should be specific
about where stringizing occurs.  IIRC, you need the object length on the
first pass, but the error handling and switchover to Unicode occur on
the second.



Raymond

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