Re: what's wrong with "lambda x : print x/60,x%60"



Steve Holden wrote:
Paul Rubin wrote:
....  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

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.
Or, if you must:

def called(function):
    function()
    return called

then:

@called
def called():
    <whatever>

;-)

--
-Scott David Daniels
scott.daniels@xxxxxxx
.



Relevant Pages

  • Re: Need help with a Dynamic Image Generation Service VB 1.1 (similar to 2.0)
    ... > Hi Moondaddy, ... I think we can first try to isolate the problem to a> smaller scope. ... Have you try adding some break points into the code and> runtime debug the code to see what is the root cause of the problem? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Oscilloscope, How TO?
    ... > | Don't isolate the scope from AC power ground. ... when you use an isolation transformerthen to isolate your ... I think the ideal setup would be, an isolation transformer to isolate ... the whole work bench and a second separate isolation transformer ...
    (sci.electronics.repair)
  • Re: Oscilloscope, How TO?
    ... | Don't isolate the scope from AC power ground. ... when you use an isolation transformerthen to isolate your ... | Most 2 channel scopes have channel A+ ... The only propper way is a fully differential probe like ...
    (sci.electronics.repair)
  • Re: Monsanto
    ... What he is supposed to do is beyond the scope of this argument. ... What he is NOT supposed to do is identify, isolate, and propagate ... surrounding fields. ... This is were the big problem lies. ...
    (rec.gardens.edible)