Function override?

Bjorn Pettersen bjorn at roguewave.com
Thu Mar 30 23:25:01 CEST 2000


Don't try to program C++ in Python (you'll just waste a lot of time).

The "right" way to do this is something similar to:

	class over:
		def somefunInt(self, bakeint):
			pass
		def somefunString(self, bakestr):
			pass

I'm sure others will chime in with various workarounds...

Python-doesn't-have-function-overloading-so-don't-use-it'ly y'rs
--bjorn

Arint? wrote:
> 
> I have a class similar to this:
> 
> class over:
>    somefun(self, bakeint):
>       ...
>    somefun(self, bakeStr):
> 
> If the user uses a string then I want to use the 2nd one, else an
> Integer then use the 1st one?
> 
> How can I get this?  And what is this call in c, the word escapes me
> right now.
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.
> --
> http://www.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list