dict!ident as equivalent of dict["ident"]

Alexander Kozlovsky alexander.kozlovsky at gmail.com
Sun May 21 08:19:29 EDT 2006


Hello all!
I have small silly syntax suggestion (SSSS)

In many cases, keys in dictionary-like objects are strings,
and moreover - valid Python identifiers. Something like:

    foo["bar"]["baz"].x = y

How about small syntactic sugar:

    foo!bar!baz.x = y

With this suggestion,           mapping!identifier
becomes fully equivalent to     mapping["identifier"]


-- 
Best regards,
 Alexander                mailto:alexander.kozlovsky at gmail.com




More information about the Python-list mailing list