Access atributes of different class..

Discussion in 'Python' started by Balaji, Jun 10, 2004.

  1. Balaji

    Balaji Guest

    Hello Everybody...

    This is what I'm trying to do..

    from generation import*

    class codegeneration:

    def __init__(self,expr):

    self.LP={}
    self.P=[]
    self.F=1.
    self= MatrixGenerator(expr)
    self.stackManagement(expr)

    generation module has the method stackManagement and its defined in
    class matrix generator.

    stackManagement return self. results..matrix Generator has an
    dictionary self.results

    when stackManagement is called something gets into self.results.

    Now I want to access this self.results thru codegeneration.

    How can I do that..

    Balaji
     
    Balaji, Jun 10, 2004
    #1
    1. Advertising

  2. Balaji

    Peter Otten Guest

    Balaji wrote:

    > Hello Everybody...
    >
    > This is what I'm trying to do..
    >
    > from generation import*
    >
    > class codegeneration:
    >
    > def __init__(self,expr):
    >
    > self.LP={}
    > self.P=[]
    > self.F=1.
    > self= MatrixGenerator(expr)
    > self.stackManagement(expr)
    >
    > generation module has the method stackManagement and its defined in
    > class matrix generator.
    >
    > stackManagement return self. results..matrix Generator has an
    > dictionary self.results
    >
    > when stackManagement is called something gets into self.results.
    >
    > Now I want to access this self.results thru codegeneration.
    >
    > How can I do that..


    See if you can get hold of an introductory text. What you want is
    inheritance (untested, of course):

    import generation
    class codegeneration(generation.MatrixGenerator):
    def __init__(self, expr):
    generation.MatrixGenerator.__init__(self, expr)
    self.LP = {}
    self.P = []
    self.F = 1.0
    self.stackManagement(expr)

    Peter
     
    Peter Otten, Jun 11, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. E11
    Replies:
    1
    Views:
    4,842
    Thomas Weidenfeller
    Oct 12, 2005
  2. =?ISO-8859-15?Q?Joachim_Wei=DF?=

    textstring as atributes in xsl

    =?ISO-8859-15?Q?Joachim_Wei=DF?=, Apr 1, 2005, in forum: XML
    Replies:
    2
    Views:
    403
    =?ISO-8859-15?Q?Joachim_Wei=DF?=
    Apr 2, 2005
  3. christopher diggins
    Replies:
    16
    Views:
    769
    Pete Becker
    May 4, 2005
  4. Joseph Turian
    Replies:
    5
    Views:
    607
  5. Edward
    Replies:
    3
    Views:
    123
    Robert Klemme
    Sep 17, 2006
Loading...

Share This Page