Re: what's wrong with "lambda x : print x/60,x%60"
- From: Scott David Daniels <scott.daniels@xxxxxxx>
- Date: Thu, 08 Dec 2005 12:04:45 -0800
Steve Holden wrote:
Paul Rubin wrote:If this genuinely troubles you then you can always isolate the scope with a function, though of course you also no longer have the code inline then..... I think it's a Python weakness that you can't declare a local var like in other languages, to go out of scope at the end of the current block, e.g.:
if cond: my x = 7 # make a new scope for x, goes out of scope at end of if
Or, if you must:
def called(function):
function()
return calledthen:
@called
def called():
<whatever>;-)
-- -Scott David Daniels scott.daniels@xxxxxxx .
- References:
- Re: what's wrong with "lambda x : print x/60,x%60"
- From: Gary Herron
- Re: what's wrong with "lambda x : print x/60,x%60"
- From: rurpy
- Re: what's wrong with "lambda x : print x/60,x%60"
- From: Sybren Stuvel
- Re: what's wrong with "lambda x : print x/60,x%60"
- From: Fredrik Lundh
- Re: what's wrong with "lambda x : print x/60,x%60"
- From: Steven D'Aprano
- Re: what's wrong with "lambda x : print x/60,x%60"
- From: Steve Holden
- Re: what's wrong with "lambda x : print x/60,x%60"
- From: Paul Rubin
- Re: what's wrong with "lambda x : print x/60,x%60"
- From: Steve Holden
- Re: what's wrong with "lambda x : print x/60,x%60"
- Prev by Date: Re: how to put form and display its result(data from database) on the same window?
- Next by Date: Re: Bitching about the documentation...
- Previous by thread: Re: what's wrong with "lambda x : print x/60,x%60"
- Next by thread: Re: what's wrong with "lambda x : print x/60,x%60"
- Index(es):
Relevant Pages
|