full closures
Michael P. Soulier
msoulier at nortelnetworks.com_.nospam
Wed Feb 27 16:39:02 EST 2002
More information about the Python-list mailing list
Wed Feb 27 16:39:02 EST 2002
- Previous message (by thread): full closures
- Next message (by thread): full closures
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 27 Feb 2002 20:37:15 GMT, Terry Reedy <tjreedy at home.com> wrote: > >>>> def prcnt(counter = [0]): > ... print "The current count is %d" % counter[0] > ... counter[0] = counter[0] + 1 > ... >>>> prcnt() > The current count is 0 >>>> prcnt() > The current count is 1 But that doesn't work with multiple instances of prcnt. They all share the same reference to the default list you created. Mike -- Michael P. Soulier, QX41, SKY Tel: 613-765-4699 (ESN: 39-54699) Optical Networks, Nortel Networks, SDE Pegasus "...the word HACK is used as a verb to indicate a massive amount of nerd-like effort." -Harley Hahn, A Student's Guide to Unix
- Previous message (by thread): full closures
- Next message (by thread): full closures
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list