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/2014-January/131309.html below:

[Python-Dev] PEP 460: allowing %d and %f and mojibake

[Python-Dev] PEP 460: allowing %d and %f and mojibake [Python-Dev] PEP 460: allowing %d and %f and mojibakeGeorg Brandl g.brandl at gmx.net
Sun Jan 12 21:05:30 CET 2014
Am 12.01.2014 20:30, schrieb Emile van Sebille:
> On 01/12/2014 09:26 AM, Paul Moore wrote:
>> Can you give an example of code that is *nearly* acceptable to you,
>> which works in Python 2 and 3 today, and explain what improvements you
>> would like to see to it in order to use it instead of waiting for a
>> core change?
> 
> 
> I'm not a developer, but I'm trying to understand how in v3 I accomplish 
> what in v2 is easy:
> 
> len(open('chars','wb').write("".join(map (chr,range(256)))).read())
> 
> What's the v3 equivalent?

That's actually very easy and shows a strength of the bytes type,
since there's no text involved:

open('chars', 'wb').write(bytes(range(256)))

Georg

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