Interpolation (was: Keyword calling gotcha ?)
Darrell
news at dorb.com
Thu May 27 14:03:24 EDT 1999
Let me show my ignorance a bit.
def a(**x):
... print x
>>> def b(**x):
... a(x)
When 'b' calls 'a' it is passing a dictionary while 'a' wants a keyword
thing
that it resolves to a dictionary. Wouldn't be nice if the keyword thing
could
mark the dictionaries it creates. Then just pass them though when it sees
one if the only other choice was an error.
Yes this sounds like a possible programmer trap. Like one of those silent
C++ type conversions.
So as Marko said come up with interpolate(args).
Humm. Marko do you have such a function ?
Thanks
--Darrell
Marko Schulz <4mschulz at informatik.uni-hamburg.de> wrote in message
news:7ijqr6$pd7$1 at rzsun02.rrz.uni-hamburg.de...
> It would be nice to have a way of interpolating sequences in parameter
> lists. In Perl it is done automatically, which causes confusion
> regularly, but it would be nice in Python sometimes too.
>
> If it were done with a new function one could also write a function,
> that computes all base_classes to a class on-the-fly:
> class Derived( interpolate(base_classes(args)) ):
> :
> :
>
> At the moment base_classes may only return one base class. Many
> apply(function,args) could be turned into function( interpolate(args) )
>
> This would be especially nice for those (self,)-Tupels, as it was used
> in the original posting above.
>
> Of cause a nicer syntax oder name than interpolate() might be found.
>
> --
> marko schulz
> "Die Welt ist gut, die Welt ist schlecht.
> Ich seh' mehr als ich begreifen kann. Ich sehe in 3-D."
> '3-D', Extrabreit
More information about the Python-list
mailing list