How can I create a dict that sets a flag if it's been modified
Dan Sommers
me at privacy.net
Thu Jan 12 06:50:24 EST 2006
On Thu, 12 Jan 2006 03:42:21 -0600,
Brian van den Broek <broek at cc.umanitoba.ca> wrote:
> It's broken in at least one way:
>>>> newmd = ModFlagDict(3=4, 1=5)
> SyntaxError: keyword can't be an expression
>>>>
> So, as it stands, no integers, floats, tuples, etc can be keys on
> initialization ...
That has nothing to do with your code:
>>> dict(1=4)
SyntaxError: keyword can't be an expression
>>> int(4=5)
SyntaxError: keyword can't be an expression
The names of keyword arguments have look like Python identifiers; 1 and
4 are *not* valid Python identifiers.
Regards,
Dan
--
Dan Sommers
<http://www.tombstonezero.net/dan/>
More information about the Python-list
mailing list