A general description of my issue. To my understand, python's feature such as "name-reference-object" and "garbage collection" system did some of work for you, it makes your life easier, but you still need to add your explicit application in your code.
For example, Composition implementation: you may need to do 5 job with C++, but only 2 job with python, the other 3 job is done by python implicitly. association implementation: You need 3 job with C++, but 1 with python. it seems python's object's lifecycle handling has reached this level, all you should do is just "associating and de-association". Here is exactly of my question, for composition, the best code may be you do 2 job explicitly, 3 job done by python implicitly. Code_Zero. 1 job(by you) + 4(by python) does NOT work. Code_one. 2 job(by you) + 3(by python) works. That is the best one. Code_two. 3 job( by you) + 2 (by python) works too, Code_three. 4 job(by you) + 1(by python) works too. Since i am not familiar with python yet, my code most likely would gets into Code_two or Code_three(Code_Zero is also possible for new guys like me), though they also work, they are bad code. What i am looking for is the Code_one example, i thought many OOP application designer may have met this issue, so a good Code_one reference is the best choice to start this project. 2011/11/11 Jerry Zhang <jerry.scofi...@gmail.com> > > > 2011/11/11 Chris Angelico <ros...@gmail.com> > >> On Fri, Nov 11, 2011 at 10:14 AM, Chris Kaynor <ckay...@zindagigames.com> >> wrote: >> > Continuing this OT discussion, would it be a brain transplant, or a >> > full body transplant? >> >> It's just a rebinding. You don't move the body, you just bind your >> name to a new body. It's perfectly legal to have two names bound to >> one body (cf Dr Jekyll and Mr Hyde); if you murder Mr Hyde, you can >> still access the body through the other name. >> >> This is association, not aggregation or composition. You already realized > that there is difference between these relationship(depending on your > application requirement). and you are trying to tell me to code a > aggregation and the composition with the same code. > > > >> ChrisA >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > >
-- http://mail.python.org/mailman/listinfo/python-list