[Python-ideas] About calling syntax

Georg Brandl g.brandl at gmx.net
Tue Sep 9 20:23:22 CEST 2008


Bruce Frederiksen schrieb:
> Leif Walsh wrote:
>> On Tue, Sep 9, 2008 at 11:16 AM, Zaur Shibzoukhov <szport at gmail.com> wrote:
>>   
>>> Would be desirable to allow two equivalent forms of calling syntax in python:
>>>
>>> <caller>(<positional_arguments>, <keyword_arguments>)
>>>
>>> and
>>>
>>> <caller>(<keyword_arguments>, <positional_arguments>)
>>>
>>> ?
>>>     
>>
>> I think you are talking about PEP 3102: http://www.python.org/dev/peps/pep-3102/
>>   
> I don't think so.  This PEP does not affect the syntax for calling a 
> function.

It does, in that you can do

foo(*args, flag=True)

which is currently a SyntaxError.

However, exchanging poisitional and keyword arguments is not in the scope of
the PEP, and isn't likely to have any future at all -- it's just too ambiguous
when the called object has named arguments instead of a catch-all *args in
its signature.

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.




More information about the Python-ideas mailing list