Polymorphism

Ville Vainio vvainio at tp.spt.fi
Tue Aug 6 08:15:43 EDT 2002


Carlos Moreira <duduca007 at yahoo.com> wrote in message news:<mailman.1028582228.9972.python-list at python.org>...
> How Python implement Polymorphism?

Invoke a method on an object. If the object has the method, it gets
called. If it doesn't, you get an exception. Could it be any simpler?

>>> "hello".albatross()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'str' object has no attribute 'albatross'



More information about the Python-list mailing list