Bugs item #1113984, was opened at 2005-02-01 14:47 Message generated for change (Comment added) made by cito You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1113984&group_id=5470
Category: Parser/Compiler Group: Python 2.4 Status: Closed Resolution: Wont Fix Priority: 5 Submitted By: Christoph Zwerschke (cito) Assigned to: Nobody/Anonymous (nobody) Summary: keywords in keyword_arguments not possible Initial Comment: Currently it is not possible to use keywords in expressions of the type "keyword_arguments". Example: d = {'fi': 1, 'if': 1} d.update(fi = 2) # ok d.update(if = 2) # error If possible, this restriction should be removed. ---------------------------------------------------------------------- >Comment By: Christoph Zwerschke (cito) Date: 2005-02-01 19:49 Message: Logged In: YES user_id=193957 Maybe I should explain my motivation for making this request. In Kid [http://kid-template.sf.net], a xml templating language, it is possible to set xml attributes with a Pythonic syntax, like this: <p py:attrs="class=myclass, bgcolor=mycolor, id=173" /> This expression is dynamically evaluated. If myclass="aclass" and bgcolor="blue", then this would produce the following: <p class="aclass" bgcolor="blue" id="173"> Internally, this is of course realized by creating a dictionary that contains the attributes of the tag, and then creating an update statement with the string in py:attrs as argument. The problem arises when one of the attributes is a Python keyword, "class" being a particularly embarassing example. My current solution is to parse the py:attrs expression manually and mangle the names. If Python could handle Python keywords here, it would be a whole lot easier and faster. ---------------------------------------------------------------------- Comment By: Raymond Hettinger (rhettinger) Date: 2005-02-01 18:46 Message: Logged In: YES user_id=80475 It's possible, but hard to implement and unwise in any case. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1113984&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com