[Python-ideas] Dict-like object with property access

Ethan Furman ethan at stoneleaf.us
Wed Feb 1 01:42:24 CET 2012


Terry Reedy wrote:
> On 1/31/2012 1:06 PM, Eric Snow wrote:
> 
>> +1 for reconsidering the d.[name] / d.(name) / d!name syntax.
> 
> d.[name] is too much like d[name] The . that modifies the meaning of 
> 'name' is too far away.
> 
> d.(name) is like d.name except to me the () means to use the value of 
> name rather than 'name' itself. This is just what you are trying to say. 
> I believe () is used elsewhere with that meaning. I could live with this.
> 
> d!name has the advantage? of no brackets, but just looks crazy since ! 
> meant 'not' in Python.


I'm not a fan of any of the .[], .(), .{} patterns, nor of .! .

What about the colon?

d:name  #use the value of name

~Ethan~



More information about the Python-ideas mailing list