[BangPypers] calling instance of the other class.

learningpython learningpython at aol.com
Tue Jun 23 23:07:31 CEST 2009


Thank you Senthil. 

It's been a learning exp for me.. I must pace up, i promise if given
continued opportunity to code, i will learn soon. This is a running project,
so the flattner is very much needed. I hope i learn more.
Actually created a system wherein later i can use it at ease to send various
other instances of class in the same way depending on context. How about i
create each of the them and assign a name, like #define and just call them
in scripts. Please any one feel free to suggest any better way of doing.

With Thanks
Anand

Senthil Kumaran-6 wrote:
> 
> 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
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
> 
> 

-- 
View this message in context: http://www.nabble.com/calling-instance-of-the-other-class.-tp24145716p24174494.html
Sent from the BangPypers - Bangalore Python Users Group mailing list archive at Nabble.com.



More information about the BangPypers mailing list