Re: [Tutor] scoping oddity

2005-05-09 Thread Michael . Coll-Barth
Ziyad, Thanks for the tip. Much of the code written here in my office, do exactly what you describe. The code I am working on is purely personal and educational. I guess I got sloppy, which in a way is educational. All, Obviously, you can't put every variable on the 'def' line. Is there a

Re: [Tutor] scoping oddity

2005-05-07 Thread Michael . Coll-Barth
Tanja, Bob, Brian, Many thanks for your help. And perhaps the way in which I posed the question was misleading. In a process I am writing, I was actually trying not to use global variables, as I agree with Brian. However, I inadvertantly used a variable within a 'def' block that I had used ou

[Tutor] scoping oddity

2005-05-07 Thread Michael . Coll-Barth
Good morning, I came across a rather odd issue with scoping. Can someone explain why testa and testc works, but not testb. I am running under python 2.4.1 on Windows NT. thanks, Michael x = 5 def testa(astr): print astr, x testa(22) def testb(astr): x = x - 1 print astr, x