polymorphism w/out signatures?

pugnatio2 at yahoo.com pugnatio2 at yahoo.com
Fri May 7 14:07:28 EDT 2004


Thanks to all who replied. I think I've got it straight now, and by
the way I did use "polymorphism" incorrectly; I should have said
"method overloading."

I guess I have my choice between separate callables and using type()
or isinstance().

What I had hoped to do was something like:

xmlDoc = myFormat2XML(obj)

where 'obj' could be either a text string or a sequence of lines. It's
not just a problem of whether a scalar or sequence object is passed
in. Strings, lists, and tuples are all sequences.

The deprecation I read, about avoiding type() (p. 129 of _Python in a
Nutshell_) said it interfered with (true) polymorphism (via
inheritance).

Cheers,

--tb



More information about the Python-list mailing list