Question about 'print' in a loop

Chris Angelico rosuav at gmail.com
Wed Nov 18 22:11:02 EST 2015


On Thu, Nov 19, 2015 at 1:55 PM, fl <rxjwg98 at gmail.com> wrote:
> There are only one time 5 'here' printed out, but there is no 'here' print
> out in thereafter call sq[2]() etc. How to understand this phenomenon?

Code does what code should.

Before you ask for comprehension of "this phenomenon", why don't you
tell us what you expect your code to do, and why? I just asked my
non-programmer sister and she was completely unsurprised by what
Python did here.

ChrisA



More information about the Python-list mailing list