[Python-3000] Implementations: A syntax for extending method dispatching beyond type/class inheritance

Dave Anderson python3000 at davious.org
Fri Dec 8 05:19:55 CET 2006


on 12/7/2006 6:40 PM Greg Ewing wrote:
> Dave Anderson wrote:
> 
>> def get_name(arg: AnyClass.name):    # AnyClass will magically have
>>     return arg.name()        # a reference to any method name
>>                     # somehow
> 
> What if you want to say that arg has more
> than one such method?
> 

def get_name_height(arg: ArgClass.name, AnyClass.height):
	return arg.name(), arg.height()

alternatively:

name_height = Implementation(ArgClass.name, AnyClass.height)

def get_name_height(arg: name_height):
	return arg.name(), arg.height()



More information about the Python-3000 mailing list