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

[Python-Dev] Incorrect behavior in str.format() method when padding with '\x00'

[Python-Dev] Incorrect behavior in str.format() method when padding with '\x00' [Python-Dev] Incorrect behavior in str.format() method when padding with '\x00'Eric V. Smith eric at trueblade.com
Thu Apr 3 17:20:20 CEST 2014
On 04/02/2014 04:08 PM, John Tyree wrote:
> 
> Hi all,
> 
> Is there any particularly reason for the following behavior on both
> 2.7.6 and 3.4.0 ?
> 
>     >>> "{:\x00<5}".format(2)
>     '2    '
>     >>>
>     "{:\x20<5}".format(2)                                                                                                
> 
>     '2    '
>     >>>
>     "{:\x01<5}".format(2)                                                                                                
> 
>     '2\x01\x01\x01\x01'
>     >>> "{:\x00<5}".format(2) ==
>     "{:\x20<5}".format(2)                                                                       
> 
>     True
> 
> 
> The docs say "If a valid /align/ value is specified, it can be preceded
> by a /fill/ character that can be any character and defaults to a space
> if omitted," so I'm inclined to call this a good old fashioned bug.

I'd say it's a bug. Please open a bug, assign it to me (eric.smith), and
I'll comment on it there.

Eric.


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