Function parameter type safety?
michele.simionato at gmail.com
Fri Jul 13 17:06:08 CEST 2007
On Jul 13, 4:53 pm, Robert Dailey <rcdai... at gmail.com> wrote:
> Good replies.
> I'm in the process of learning Python. I'm a native C++ programmer, so
> you can see how the question relates. There's a lot of cool things C++
> allowed you to do with type-checking, such as function overloading.
This is an area of hot debate in Python and things are changing. You
to have a look at http://www.python.org/dev/peps/pep-3119 about
and to http://www.python.org/dev/peps/pep-3124 about overloading and
generic functions. Both PEPs are for Python 3000, but their existence
should be an indication that people are not happy with the current
in Python. You can something better than overloading already, with
modules simplegeneric and/or RuleDispatch, but I would say that they
commonly used. So the right thing to do for now is to follow the good
advices you received, but keep in mind that there will be alternatives
the near future (such as interface checking/function overload).
More information about the Python-list