[Python-Dev] Dict access with double-dot (syntactic sugar)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 24 22:00:49 CET 2011


Jameson Quinn wrote:
> def fun2(**kw):
> print kw["argument"]

Since this function effectively has a compulsory argument
called 'argument', it would be better written
 def fun2(argument, **kw):
 print argument
or, if the recently-added keyword-only feature is available,
 def fun2(*, argument, **kw):
 print argument
-- 
Greg


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /