definition of 'polymorphism' and python
Ben Sizer
kylotan at gmail.com
Wed Dec 14 06:43:36 EST 2005
Gabriel Zachmann wrote:
> I understand the Wikipedia article on Polymorphism
> ( http://en.wikipedia.org/wiki/Polymorphism_%28computer_science%29 )
> that it doesn't make sense to talk about polymorphism in a fully dynamically
> typed language -- does the Python community agree?
"In computer science, polymorphism means allowing a single definition
to be used with different types of data (specifically, different
classes of objects)."
>>> len("abcd")
4
>>> len([1,2,3,4,5,6])
6
Looks pretty polymorphic to me. In fact, Python's polymorphism support
is so good that it makes inheritance much less important than it is in
other languages.
--
Ben Sizer
More information about the Python-list
mailing list