[Python-ideas] Python Users Aren't Perfect

Ethan Furman ethan at stoneleaf.us
Fri Dec 16 08:50:11 CET 2011


Greg Ewing wrote:
> Ned Batchelder wrote:
>> Finish that foo function definition: it will *have* to have  "for a in 
>> args:"
> 
> Not necessarily. It might be something like this:
> 
>    def foo(*args):
>       if len(args) == 2:
>          x, y = args
>          fizzle2d(x, y)
>       else:
>          x, y, z = args
>          fizzle3d(x, y, z)
> 
> In other words, it might be what is effectively an
> overloaded function with a number of different possible
> calling signatures. Once you've decided which signature
> is being invoked, each member of the argument tuple
> takes on a specific role.
> 

Thanks, Greg -- this is pretty much what I meant about dynamic structs.  :)

~Ethan~



More information about the Python-ideas mailing list