¡@

Home 

python Programming Glossary: classa

How to replace an instance in __init__() with a different object?

http://stackoverflow.com/questions/3209233/how-to-replace-an-instance-in-init-with-a-different-object

with a different object I am calling a constructor in ClassA and want to have the resulting object be of a different class.. but it doesn't seem to do what I want. in main import ClassA my_obj ClassA.ClassA 500 # unfortunately my_obj is a ClassA.. seem to do what I want. in main import ClassA my_obj ClassA.ClassA 500 # unfortunately my_obj is a ClassA but I want a ClassB..

Import from sibling directory

http://stackoverflow.com/questions/4542352/import-from-sibling-directory

from sibling directory I have a Python class we'll call ClassA and another Python class which is supposed to import ClassA.. and another Python class which is supposed to import ClassA which we'll call ClassB. The directory structure is as follows.. directory structure is as follows MainDir .. Dir .... DirA ClassA .... DirB ClassB How would one use sys.path so that ClassB can..

Inheritance and base class method call python

http://stackoverflow.com/questions/7841812/inheritance-and-base-class-method-call-python

6 Class A 9 Can this be done # Base class definition class ClassA object def __init__ self print Initializing A # hoping that.. def fnX self x return x 2 def printFnX self x print ClassA self.fnX x # Inherits from ClassA above class ClassB ClassA.. printFnX self x print ClassA self.fnX x # Inherits from ClassA above class ClassB ClassA def __init__ self print initizlizing..