python newbie

Jim Hendricks jim at bizcomputinginc.com
Fri Nov 2 09:51:44 EDT 2007


New to python, programming in 15 or so langs for 24 years.

Couple of questions the tuts I've looked at don't explain:

1) global vars - python sets scope to the block a var is declared (1st 
set), I see the global keyword that allows access to global vars in a 
function, what I'm not clear on is does that global need to be declared 
in the global scope, or, when 1st set in a function where it is listed 
as a global, does that then declare the necessary global.

2) Everything is an object.  So then, why the distinction between 
functions/variables and fields/methods.  If a module is an object, would 
not every function be a method of that module and every variable be a 
field of that module?

I'm sure I will have other questions, but, I have a specific task that I 
am coding in python, and having a better understanding of the language 
will keep me from writing crap based on other language bias.

TIA,
Jim



More information about the Python-list mailing list