How do you feel ?

Peter Hansen peter at engcorp.com
Fri Aug 6 20:36:39 EDT 2004


Howard Stearns wrote:
> The one thing I've found annoying is that I haven't yet discovered how 
> to do whatever I want in lambda expressions. I have top-level 
> assignments where I'd like create a function to use as the the value 
> being assigned. I don't know how to define a named function in a 
> top-level assignment, and a lambda won't allow me to use 'try' and other 
> statements -- just expressions. Or am I looking at things wrong?

What do you mean by "top-level assignment"?  If it's the same
meaning most Python programmers would give it, you just do this:

def somefunc():
     pass

topLevelName = somefunc

There's your top-level assignment of a named function.  Probably
not what you meant, but can you clarify please?

-Peter



More information about the Python-list mailing list