[issue27160] str.format: Silent truncation of kwargs when passing keywords containing colons

2016-05-30 Thread Kenneth Lim

Kenneth Lim added the comment:

Ah, so the truncation is fully intended behavior.

As for the name, a touch too many comic-books in the past might be the
reason I latched onto "Barry" as a first name.

Thanks for the clarification.

On Tue, May 31, 2016 at 12:37 AM, Emanuel Barry 
wrote:

>
> Emanuel Barry added the comment:
>
> The behaviour is correct, it's your assumptions that aren't :)
>
> The code for str.format only checks for what's before the colon (here,
> "HGNC") and checks if that's part of the dict provided. It isn't, so it
> raises a KeyError. It doesn't even get to the format spec part (which is a
> perfectly valid format specifier). Your dict can contain anything or be
> empty, str.format only checks for the existence of the key you asked for
> ("HGNC"). "{HGNC:11892}" is also a perfectly valid Python string.
>
> P.S.: While I'm fine with people calling me by my last name, there's
> another developer whose name is Barry Warsaw, so let's try to avoid
> confusion here ;-)
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27160] str.format: Silent truncation of kwargs when passing keywords containing colons

2016-05-30 Thread Emanuel Barry

Emanuel Barry added the comment:

The behaviour is correct, it's your assumptions that aren't :)

The code for str.format only checks for what's before the colon (here, "HGNC") 
and checks if that's part of the dict provided. It isn't, so it raises a 
KeyError. It doesn't even get to the format spec part (which is a perfectly 
valid format specifier). Your dict can contain anything or be empty, str.format 
only checks for the existence of the key you asked for ("HGNC"). "{HGNC:11892}" 
is also a perfectly valid Python string.

P.S.: While I'm fine with people calling me by my last name, there's another 
developer whose name is Barry Warsaw, so let's try to avoid confusion here ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27160] str.format: Silent truncation of kwargs when passing keywords containing colons

2016-05-30 Thread Kenneth Lim

Kenneth Lim added the comment:

Hi Barry,

I was aware of that. However, I was alluding to the KeyError produced, and
the silent truncation of the text. Rather than failing at the colon step
(SyntaxError when on run), truncated arguments pass this step, causing
errors downstream.

On Mon, May 30, 2016 at 11:02 PM, Emanuel Barry 
wrote:

>
> Emanuel Barry added the comment:
>
> In other words, you cannot use keys containing a colon in str.format -
> you'll need to replace the colons by something else (for example an
> underscore, that works fine).
>
> --
> nosy: +ebarry
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27160] str.format: Silent truncation of kwargs when passing keywords containing colons

2016-05-30 Thread Emanuel Barry

Emanuel Barry added the comment:

In other words, you cannot use keys containing a colon in str.format - you'll 
need to replace the colons by something else (for example an underscore, that 
works fine).

--
nosy: +ebarry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27160] str.format: Silent truncation of kwargs when passing keywords containing colons

2016-05-30 Thread Emanuel Barry

Changes by Emanuel Barry :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27160] str.format: Silent truncation of kwargs when passing keywords containing colons

2016-05-30 Thread STINNER Victor

Changes by STINNER Victor :


--
title: Silent truncation of kwargs when passing keywords containing colons -> 
str.format: Silent truncation of kwargs when passing keywords containing colons

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com