__brace__ (PEP?)

Roy Smith roy at panix.com
Sun May 8 20:48:06 EDT 2005


In article <mailman.177.1115599072.29826.python-list at python.org>,
 James Stroud <jstroud at mbi.ucla.edu> wrote:

> On Sunday 08 May 2005 05:15 pm, Roy Smith wrote:
> > This seems like a pretty esoteric operation to devote a bit of syntax to.
> > It doesn't seem like something people want to do very often.
> 
> Similar to __call__, I don't think that this syntax would be neccessarily 
> devoted to any particular operation. I'm simply offering cross-sectioning as 
> a potential and intuitive operation that would benefit from a shortcut. The 
> main point is that using braces after a name is not defined right now and I 
> think that they could be put to good use.
> 
> James

One of the nice things about Python is that the syntax is relatively 
simple, and words are generally favored over punctuation.  There's lots of 
punctuation which is not currently used, but that doesn't mean it's a good 
idea to go off inventing meanings for it.  I supposed we could have:

foo->bar ==> foo.__arrrow__(bar)
foo$bar ==> foo.__dollar__(bar)
foo#bar ==> foo.__hash__(bar)
foo::bar ==> foo.__scope__(bar)

and so on down the list of non-alphanumeric characters, but the result 
wouldn't be anything most of us would recognize as Python.



More information about the Python-list mailing list