namespace question
T. Crane
tcrane at REMOVETHISuiuc.edu
Fri May 18 13:20:27 EDT 2007
Hi,
If I define a class like so:
class myClass:
import numpy
a = 1
b = 2
c = 3
def myFun(self):
print a,b,c
return numpy.sin(a)
I get the error that the global names a,b,c,numpy are not defined. Fairly
straightforward. But if I am going to be writing several methods that keep
calling the same variables or using the same functions/classes from numpy,
for example, do I have to declare and import those things in each method
definition? Is there a better way of doing this?
thanks,
trevis
More information about the Python-list
mailing list