Beginner question? Classes, variables, ...

Ángel Gutiérrez Rodríguez agr at fq.uniovi.es
Wed Jun 28 10:19:54 CEST 2006


The problem:

I have two classes:
 
class X:
  def __init__(self):
    pass

class Y:
  def __init__(self):
    self.a=1
    self.b=X()

and I would like to make 'a' visible inside 'x'. Is there a way to refer to
the Y class from the X? To make things easier :), each class is in a
different file, so class X is imported. Or the only way I have is to
pass 'a' as a variable in each method call of 'b' ('a' can take different
values that affect to the behaviour of 'b').

Thanks in advance.
-- 
Ángel Gutiérrez Rodríguez - agr at fq.uniovi.es
Instituto de Ciencia de los Materiales de Madrid - CSIC
SpLine - European Syncrothorn Radiation Facility - Grenoble - France

Postal adress: Departamento de Química Física y Analítica 
Universidad de Oviedo - c/Julián Clavería 8 33006 - Oviedo 
Asturias - Spain
E-mail: agr at fq.uniovi.es Telf.: +34-985103687



More information about the Python-list mailing list