'local' var in module
Aaron Bingham
bingham at cenix-bioscience.com
Thu Oct 7 11:25:12 EDT 2004
More information about the Python-list mailing list
Thu Oct 7 11:25:12 EDT 2004
- Previous message (by thread): Aborting a Python import from C API
- Next message (by thread): 'local' var in module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Andreas Lobinger wrote: > Aloha, > > i'm i little bit confused by the following behaviour... > > lobingera at sibyl: cat flip.py > [working code deleted] If you assign to a variable inside a function, it will define a variable local to that function, unless you explicity declare that variable as a global, like so: > def g(): global rstate > random.seed(rstate) > s = list() > > for i in range(paras['flength']): > s.append(random.choice(paras['cset'])) > > rstate = random.getseed() > return "".join(s) Aaron
- Previous message (by thread): Aborting a Python import from C API
- Next message (by thread): 'local' var in module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list