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

2006-05-22 Thread Alexander Kozlovsky
Edward Elliott 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 pars

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

2006-05-21 Thread Edward Elliott
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

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

2006-05-21 Thread Alexander Kozlovsky
Roy Smith wrote: > Define a class (perhaps a subclass of dict, if you like) > with a __getattr__ method. Then you can just do > > foo.bar.baz.x = y > > with no changes needed to the language. I think, your solution is very error-prone. If such enhanced dictionary contains "keys" key, what is me

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

2006-05-21 Thread Dan Sommers
On Sun, 21 May 2006 16:19:29 +0400, Alexander Kozlovsky <[EMAIL PROTECTED]> wrote: > How about small syntactic sugar: > foo!bar!baz.x = y > With this suggestion, mapping!identifier > becomes fully equivalent to mapping["identifier"] Take a look at the "Bunch" recipe in the Pyt

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

2006-05-21 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Alexander Kozlovsky <[EMAIL PROTECTED]> wrote: > Hello all! > I have small silly syntax suggestion () > > In many cases, keys in dictionary-like objects are strings, > and moreover - valid Python identifiers. Something like: > > foo["bar"]["baz"].x = y >