A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-February/071016.html below:

[Python-Dev] New syntax for 'dynamic' attribute access

[Python-Dev] New syntax for 'dynamic' attribute accessMaric Michaud maric at aristote.info
Tue Feb 13 05:33:00 CET 2007
Le mardi 13 février 2007 01:36, Barry Warsaw a écrit :
> On Feb 12, 2007, at 7:32 PM, Guido van Rossum wrote:
> > Oh, now I am definitely in favor of .[]! I read it in gmail in FireFox
> > which uses a small variable-pitch font whose dot is a single pixel.
> > The .() example was hard to find; the .[] jumped out immediately.
> > (When do you ever see self[anything]?)
>
> Raymond's -> suggestion was nice.
>
I really dislikes the .[ or .( or .{ operators.
Just on my mail editor the two expressions

a.[b]

and

a,[b]

are quite hard to differentiate while completely unrelated.

Why did the brace syntax wasn't even discussed ? Seems clean to me.

obj{expr} can be read as "given obj as a namespace, retrieve the name 
resulting by expr in obj and enclosing namespaces (supers)".

We can even use slice-like syntax for further improvements :

obj{expr:default} 

obj{expr:default:type_}
   something like getattr(super(type_, obj), expr, default), or even

obj{expr::}
   for getattr(super(obj.__class__, obj), expr)

and, why not, even obj{:} for super(obj.__class__, obj), 

regards,
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4