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 mrabarnett
Recipients Imagist, LambertDW, georg.brandl, mrabarnett
Date 2009-02-27.19:30:04
SpamBayes Score 1.472577e-07
Marked as misclassified No
Message-id <1235763007.0.0.613762324529.issue5382@psf.upfronthosting.co.za>
In-reply-to
Content
The normal use of a keyword argument is to refer to a formal argument,
which is an identifier. Being able to wrap it up into a dict is a later
addition, and it's necessary to turn the identifier into a string
because it's not possible to use a bare word (as Perl would call it) as
a key (I can't think of any other place where something is automatically
turned into a string). Of course, another approach would've been to make
them attributes of the formal argument:

def foo(**args):
    print "a is %s" % args.a

foo(a=1)

As for it being an exception to the rule, well, many things can be a
key: an integer could be a key. Would foo(0="zero") be OK? There's no
syntactic reason why it couldn't be allowed.

-1 from me.
History
Date User Action Args
2009-02-27 19:30:07mrabarnettsetrecipients: + mrabarnett, georg.brandl, LambertDW, Imagist
2009-02-27 19:30:07mrabarnettsetmessageid: <1235763007.0.0.613762324529.issue5382@psf.upfronthosting.co.za>
2009-02-27 19:30:05mrabarnettlinkissue5382 messages
2009-02-27 19:30:04mrabarnettcreate