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

Giovanni Bajo rasky at develer.com
Tue Feb 13 11:52:42 CET 2007


On 13/02/2007 5.33, Maric Michaud wrote:

> 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.

I'll propose a new color for this bikeshed:

a.[[b]]

  handlers = chain.get(kind, ())
  for handler in handlers:
      func = handler.[[meth_name]]
      result = func(*args)
      if result is not None:
          return result

Little heavy on the eye, but it seems that it's exactly what people want and 
can't find in the .[] syntax.
-- 
Giovanni Bajo



More information about the Python-Dev mailing list