Re: multimethod (or rather overloading) in Python

2005-02-21 Thread anton muhin
Nick Coghlan wrote: anton muhin wrote: anton muhin wrote: Correction: Of course, I can imagine some metaclasses magic that would allow to code: class MyClass(WithOverloading): @overloadMethod(A) def someMetod(self, _): ... But it would rather convoluted: the best idea I have so far is to man

Re: multimethod (or rather overloading) in Python

2005-02-19 Thread Nick Coghlan
anton muhin wrote: anton muhin wrote: Correction: Of course, I can imagine some metaclasses magic that would allow to code: class MyClass(WithOverloading): @overloadMethod(A) def someMetod(self, _): ... But it would rather convoluted: the best idea I have so far is to mangle methods name in t

Re: multimethod (or rather overloading) in Python

2005-02-17 Thread anton muhin
anton muhin wrote: Correction: Of course, I can imagine some metaclasses magic that would allow to code: class MyClass(WithOverloading): @overloadMethod(A) def someMetod(self, _): ... But it would rather convoluted: the best idea I have so far is to mangle methods name in the manner most of C

multimethod (or rather overloading) in Python

2005-02-17 Thread anton muhin
Dear pythonistas! I'd like to emulate overloading in Python (like C++). Let's consider an example: class A(object): pass class B(object): pass Of course, there are some standard overloading implementations for Python. For example: def overload(cls): def wrapper(f): gl = f.func_globals n