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

Edward Elliott nobody at 127.0.0.1
Sun May 21 14:23:51 EDT 2006


Alexander Kozlovsky wrote:

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

Penny-wise, pound-foolish.  Saves 3 character strokes at the cost of a new
special-purpose operator which only works in limited circumstances.  To
avoid parsing ambiguity, identifier can only contain (as the name implies)
alphanumerics and _.  So your ! is limited not only to dicts but to certain
keys in certain dicts.  More complicated than it's worth.

-- 
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net



More information about the Python-list mailing list