Favorite non-python language trick?
Roy Smith
roy at panix.com
Fri Jun 24 12:14:39 EDT 2005
Tom Anderson <twic at urchin.earth.li> wrote:
> The one thing i really do miss is method overloading by parameter
> type. I used this all the time in java
You do things like that in type-bondage languages like Java and C++
because you have to. Can you give an example of where you miss it in
Python?
If you want to do something different based on the type of an
argument, it's easy enough to do:
def foo (bar):
if type(bar) == whatever:
do stuff
else:
do other stuff
replace type() with isistance() if you prefer.
> No, it's not really possible in a typeless language,
Python is not typeless. It's just that the types are bound to the
objects, not to the containers that hold the objects.
More information about the Python-list
mailing list