"Alex" <[EMAIL PROTECTED]> wrote:
> But what are those with double underscore? For instance __cmp__(...)?
>
> I tried
>>>> D.cmp('a','b')
make that
cmp('a', 'b')
methods that start and end with "__" are implementation hooks:
http://docs.python.org/ref/specialnames.html
__cmp__ is used by cmp(a, b) and other operations that need to compare
things (unless "rich comparision" hooks are defined; see
http://docs.python.org/ref/customization.html
)
other common hooks are __init__ (called after construction), __len__ (called
to determine the length of a sequence), __getitem__ (called to fetch an item
from a container), and a few others. see the documentation for details.
</F>
--
http://mail.python.org/mailman/listinfo/python-list