Namespace issues...

Aahz aahz at pythoncraft.com
Sat Feb 14 16:28:48 CET 2004


In article <d1253dfc.0402140259.3b614b95 at posting.google.com>,
cghost <phreacker at aol.com> wrote:
>
>i am very confused...why does the following script modify the global list "l":
>
>l=[]
>def x():
>   l.append("xyz")
>x()
>print l
>
>but the same script applied to a single variable doesnt..:
>
>l="moe"
>def x():
>   l+="howdy"
>x()
>print l

http://starship.python.net/crew/mwh/hacks/objectthink.html
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Argue for your limitations, and sure enough they're yours."  --Richard Bach



More information about the Python-list mailing list