This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Jerry Dimitrov
Recipients Jerry Dimitrov
Date 2017-02-15.14:53:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487170382.81.0.823573985019.issue29568@psf.upfronthosting.co.za>
In-reply-to
Content
Hello everyone,
This is my first bug report to the python project, so please excuse me if the metadata for this particular issue is not 100% accurate.

Today I noticed (with the help from couple of people in IRC) a strange behavior in the python string formatting functionality.

Consider the following code snippets:

```
'%(a)s %(b)' % {'a': '1', 'b': '2'}

# result:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: incomplete format
```


```
'%(a) %(b)s' % {'a': '1', 'b': '2'}

# result:
'%(b)s'

# expected result:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: incomplete format
```

It seems that there is some kind of inconsistent (undefined) behavior, during the parsing of the type character for the formatted string (tested across all major python 2.x/3.x versions).

According to the documentation for string formatting and the relevant PEPs, there is no additional info about this particular case.

I want to say thank you to Yhg1s, JustASlacker, Jerub and lz1irq for discovering this 'bug/feature' and the additional information about it.

Please let me know if this is a bug, since I am not 100% sure if this is the case.
Thanks in advance for your time!

Best Regards,
Jerry
History
Date User Action Args
2017-02-15 14:53:02Jerry Dimitrovsetrecipients: + Jerry Dimitrov
2017-02-15 14:53:02Jerry Dimitrovsetmessageid: <1487170382.81.0.823573985019.issue29568@psf.upfronthosting.co.za>
2017-02-15 14:53:02Jerry Dimitrovlinkissue29568 messages
2017-02-15 14:53:02Jerry Dimitrovcreate