scope of variables
Ryan Forsythe
ryan at cs.uoregon.edu
Wed May 3 18:36:53 EDT 2006
Gary Wessle wrote:
> the example was an in-accuretlly representation of a the problem I am
> having. my apologies.
>
> a = []
> def prnt():
> print len(a)
>
>>>> prnt
> <function prnt at 0xb7dc21b4>
>
> I expect to get 0 "the length of list a"
You want prnt(), not prnt:
>>> a = []
>>> def prnt():
... print len(a)
...
>>> prnt
<function prnt at 0x43c70>
>>> prnt()
0
--Ryan
More information about the Python-list
mailing list