Why not 3.__class__ ?

Erik Max Francis max at alcyone.com
Tue Oct 9 19:38:19 CEST 2001


Emile van Sebille wrote:

[Fixing top posting]
> "Paul Rubin" <phr-n2001d at nightsong.com> wrote:
>
> > How about (3).foo?
>
> Because tuples have methods now.
> 
> Python 2.2a4+ (#56, Oct  4 2001, 12:59:29)
> [GCC 2.96 20000731 (Red Hat Linux 7.0)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> dir(())
> ['__add__', '__class__', '__contains__', '__delattr__', '__eq__', '__ge__',
> '__getattribute__', '__getitem__', '__getslice__', '__gt
> __', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mul__',
> '__ne__', '__new__', '__reduce__', '__repr__', '__rmul__', '_
> _setattr__', '__str__']

Irrelevant, since (3) isn't a tuple, it's an expression which evaluates
to 3.  You were thinking of (3,), but that's not what the original
poster wrote.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ They make it a desert and call it peace.
\__/ Tacitus
    Maths reference / http://www.alcyone.com/max/reference/maths/
 A mathematics reference.



More information about the Python-list mailing list