Re:A few things to remember while coding in Python
by ScottBurson on Saturday May 19, 2012 @09:23PM
(#3997619)
No. In my example the function is created only once, and called twice.
[ Parent
| on HN ]
Re:A few things to remember while coding in Python
by anthonyb on Saturday May 19, 2012 @10:06PM
(#3997696)
What's that lambda thingo in the middle then? Pretty sure that's another function, redefined every time your function is called.
Re:A few things to remember while coding in Python
by Tyr42 on Saturday May 19, 2012 @10:49PM
(#3997752)
Yes, the lambda creates the function. Note that defvar does not. So there is still only one function being defined here.
Re:A few things to remember while coding in Python
by anthonyb on Saturday May 19, 2012 @11:16PM
(#3997806)
Ok, I see now.
You've still got that &optional argument though. I don't see a huge amount of difference from a semantic point of view between that and the Python version though (ie. if x == None: ...).