Python language suggestion

Erik Max Francis max at alcyone.com
Thu Jan 11 15:52:59 EST 2001


Chris Ryland wrote:

> This migh sound radical, but has anyone ever entertained the idea that
> foo.'bar bletch' might be a useful and logical extension of Python's
> current attribute selection machinery?
> 
> I realize that foo['bar bletch'] is just as good for dictionary-like
> objects, but foo.'bar bletch' would be very much more attractive in
> one
> application I'm considering (which must use AppleScript-style
> attributes, which can include spaces),and it seemed like a general
> improvement to allow an arbitrary (constant) string after an
> attribute "oeprator" (.).

This does not sound like a good idea.  Indexes of an object which
supports __getitem__ are totally independent of the attributes which
that object may have; comingling them with a similar syntax doesn't seem
like it would gain anything except confusion.

I mean, really -- is it that much easier to write object.key instead of
object[key]?

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ But when I reached the finished line / Young black male
\__/ Ice Cube
    Alcyone Systems / http://www.alcyone.com/
 Alcyone Systems, San Jose, California.



More information about the Python-list mailing list