python newbie

Jim Hendricks jim at bizcomputinginc.com
Fri Nov 2 16:13:00 CET 2007


BartlebyScrivener wrote:
> On Nov 2, 8:51 am, Jim Hendricks <j... at bizcomputinginc.com> wrote:
>> New to python, programming in 15 or so langs for 24 years.
>>
>> Couple of questions the tuts I've looked at don't explain:
> 
> Did you look at THE tut?  You would seem to be the perfect reader for
> it, because you are already a programmer.
> 
> http://docs.python.org/tut/node6.html#SECTION006600000000000000000
> 
> rd
> 

I initially looked at THE tut, and it came across so techy that it's 
such a slow read.  Therefore, I looked to other tuts that were very easy 
reads and could give me the basic lowdown of the language.  Problem of 
course is the easy read tuts don't get into the details.

That said, I looked at the section of the tutorial you provided (thanks) 
and I am still confused.  It specifies a global var cannot be assigned 
unless it's specified in the global statement.

Here's an example of what I am asking:

def my_function():
   global x

   x = open( ....

before calling my_function, x does not exist in my program.  So, my 
question is in my_function, the combination of using the global 
statement, then implicitly creating x via assignment to the result of 
the open function, is x created in the global namespace?



More information about the Python-list mailing list