Access atributes of different class..

B

Balaji

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
 
P

Peter Otten

Balaji said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top