[Tutor] Accessing Variables
Adam
adam.jtm30 at gmail.com
Wed Oct 5 23:42:26 CEST 2005
What you can do is if ONE.py has a class with the variable a, in it, you can
pass the class instance (ie. self) and then you can call any function or get
any global class variable.
eg
def foo(parent):
print parent.a
On 05/10/05, Matt Williams <matthew.williams at cancer.org.uk> wrote:
>
> Dear List,
>
> I'm trying to clarify something about accessing variables.
>
> If I have ONE.py file with some variable a, and ONE imports TWO, which
> has a variable b, can TWO access variable a (I don't think so, but I
> just thought I'd check).
>
> I guess the way round this is just to make some classes & objects, and
> then they can easily pass parameters to each other, but I just thought
> I'd check.
>
> Matt
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051005/70c22171/attachment.html
More information about the Tutor
mailing list