
16 Dec
2011
16 Dec
'11
1:50 a.m.
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~