[Python-3000] Open Issues for string.format PEP

Talin talin at acm.org
Mon Apr 24 21:51:53 CEST 2006


Ian Bicking <ianb <at> colorstudy.com> writes:

> 
> Talin wrote:
> >>>Here's a condensed list of the open issues that have been raised by people
> >>>so far:
> >>
> >>I'm not sure whether this was raised explicitly, but Ian at least
> >>mentioned it:  Are they keys to the dictionary in some way restricted?
> >>
> >>For instance, I think it would be reasonable to say that only valid
> >>names (or possibly expressions starting with a valid name) would be
> >>looked up in the dictionary, as a way of explaining why {0} means
> >>position zero, rather than dict['0'].
> > 
> > 
> > Think 'keyword arguments', not 'dict keys'. You can't call a function 
with '0'
> > as a keyword.
> 
> Sure you can, func(**{'0': 'x'}).  Anytime you use ** as a first-class 
> way of passing in a dictionary argument, keywords that are not valid 
> Python identifiers will get passed in, often intentionally.
> 

Well, let me phrase it another way. The question was, what limits should be 
placed on field identifiers, and more specifically, what is the rationale for 
distinguishing between '0' and 'name'? And my answer to this is, that the 
interpretation of field names should be the same as the interpretation of 
keyword arguments by the Python parser.

-- Talin




More information about the Python-3000 mailing list