Did you read the entire discussion at http://www.ibiblio.org/g2swap/byteofpython/read/local-variables.html?
What did you understand and not understand? Sincerely, e. bill.wu wrote: > i am new guy. > i ask a easy question. > why the first one have"x",the second one doesn't have "x". what is > different? when write "x",when don't write "x". > in my point,the second one don't def variable. > (1) > def |func||*(x)*:| > | print ||'x is'||, x| > | x = ||2| > | print ||'Changed local x to'||, x| > > |x = ||50| > |func*(x)*| > |print ||'x is still'||, x| > > (2) > def |func||*()*:| > | global ||x| > > | print ||'x is'||, x| > | x = ||2| > | print ||'Changed local x to'||, x| > > |x = ||50| > |func*()*| > |print ||'Value of x is'||, x| > > ____________________________________________________________________ > /*DreamMail*/ - 第一次不用是你的错,第二次不用是我的错 > www.dreammail.org <http://www.dreammail.org> > ------------------------------------------------------------------------ > > _______________________________________________ > Tutor maillist - [email protected] > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
