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

[Python-Dev] PEP 461 updates

[Python-Dev] PEP 461 updates [Python-Dev] PEP 461 updatesGreg Ewing greg.ewing at canterbury.ac.nz
Thu Jan 16 04:54:06 CET 2014
Glenn Linderman wrote:
> 
> x = 354
> b"%c" % x
> 
> Is this an intended exception to the overriding principle?

I think it's an unavoidable one, unless we want to
introduce an "integer in the range 0-255" type. But
that would just push the problem into another place,
since

    b"%c" % byte(x)

would then blow up on byte(x) if x were out of
range.

If you really want to make sure it won't crash, you
can always do

   b"%c" % (x & 0xff)

or whatever your favourite method of mangling out-
of-range ints is.

-- 
Greg
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