Collections of non-arbitrary objects ?

Ben Finney bignose+hates-spam at benfinney.id.au
Sun Jun 24 09:13:54 EDT 2007


walterbyrd <walterbyrd at iname.com> writes:

> Suppose you are sequentially processing a list with a routine that
> expects every item to be of a certain type. Something in the list
> that doesn't conform to the type could give you unexpected results,
> maybe crash your application.

A routine that demands its inputs to be of a certain *type*, rather
than requiring that the implement the required *behaviour*, breaks
polymorphism.

Polymorphism is considered valuable in Python; search for any of
"polymorphism", "duck typing" and "easier to ask forgiveness than
permission".

-- 
 \        "Intellectual property is to the 21st century what the slave |
  `\                           trade was to the 16th."  -- David Mertz |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list