[BangPypers] calling instance of the other class.

Senthil Kumaran orsenthil at gmail.com
Tue Jun 23 18:05:30 CEST 2009


On Tue, Jun 23, 2009 at 03:50:42AM -0500, Jeff Rush wrote:
> > just pass the & of the another structure in the structure element, some
> > thing close.
> 
> The equivalent to the & operator in C is just an object reference in Python.
> 

Yes, the Original Poster (learningpython):

When you have:

class MyClass:
        def __init__(self):
                self.attr1 = 'Hello'

Foo = MyClass
Obj = Foo()
print Obj.attr1 

This will show that class was assigned using the reference.

Original Poster again, just try to understand this session

>>> class MyClass1:
...     def __init__(self):
...             self.attr1 = 'Hello'
... 
>>> class MyClass2:
...     def __init__(self):
...             self.attr2 = MyClass1()
... 
>>> obj = MyClass2()
>>> print obj.attr2
<__main__.MyClass1 instance at 0x7fe2061b1488>
>>> print obj.attr2.attr1
Hello
>>> 


I hope you have a bit of clarity now.


Jeff: you seem to have got what he was trying to do with message
sending. Is this some standard way over serial port, as you went
upto the mention or flatteners.

But, exposing the learner to twisted and flatteners would be bit too
much of a high dose IMHO.

-- 
Senthil
<Overfiend> the kind of landscape that laughs at "AWD" vehicles and
            sends them tumbling into ravines


More information about the BangPypers mailing list