<br><br><div class="gmail_quote">On Wed, Nov 19, 2008 at 8:58 PM, alex23 <span dir="ltr"><<a href="mailto:wuwei23@gmail.com">wuwei23@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Nov 20, 10:14 am, Aaron Brady <<a href="mailto:castiro...@gmail.com">castiro...@gmail.com</a>> wrote:<br>
> If you had a menu in a browser interface that had the items, say,<br>
> 'Stop' and 'Reload', what would you expect to happen if you clicked on<br>
> them?<br>
<br>
</div>If you had a keyword called 'def', which defined functions, would you<br>
expect it to define said functions when it executed, or on each<br>
function call?<br>
<div><div></div><div class="Wj3C7c">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br><br>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.<br>
<br>I'm willing to bet that people surprised by the behavior of def are also surprised by:<br>a = [1,2,3]<br>b = a<br>b.append(4)<br>a<br>[1,2,3,4]<br><br>compared to:<br>a = 4<br>b = a<br>b = 5<br>a<br>4<br><br>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.<br>