On Wed, Nov 19, 2008 at 8:58 PM, alex23 <[EMAIL PROTECTED]> wrote: > On Nov 20, 10:14 am, Aaron Brady <[EMAIL PROTECTED]> wrote: > > If you had a menu in a browser interface that had the items, say, > > 'Stop' and 'Reload', what would you expect to happen if you clicked on > > them? > > If you had a keyword called 'def', which defined functions, would you > expect it to define said functions when it executed, or on each > function call? > -- > http://mail.python.org/mailman/listinfo/python-list >
I think that most of the issue here stems from people not understanding the "quirks" of "variable assignment" in python, not so much expecting the def statement to get re-evaluated every time a function is called. I'm willing to bet that people surprised by the behavior of def are also surprised by: a = [1,2,3] b = a b.append(4) a [1,2,3,4] compared to: a = 4 b = a b = 5 a 4 This makes sense if you've read (and understood!) the docs, or if you're familiar with other programming languages that have similar behavior, but a lot of people learn python as a first language these days - and a lot of those people learn it largely by playing around, not by studying the documentation. I can definitely see how the behavior could be confusing to a newcomer.
-- http://mail.python.org/mailman/listinfo/python-list