[EMAIL PROTECTED] a écrit :
> Im tryin to call
s/call/access/
> a var thats sitting
s/sitting/defined/
> in a function, example:
In this example, s/function/class/
> class someclass(object):
pep08 : should be SomeClass(object):
> somevar = open(blah, 'r').readlines()
Doing IO in the body of a class statement is IMHO a *very* bad idea.
>
> def something():
>
> for line in somevar:
> print line
> -----------------------------------------------------------------------
>
> i guess im not graspng the whole global or local var topic..
Seems there are a couple other points you're net yet grasping. Anyway,
in this case, you should pass the iterable object to your function:
def something(iterable):
for line in iterable:
print line
something(someclass.somevar)
--
http://mail.python.org/mailman/listinfo/python-list