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
2011/11/11 Chris Angelico
> On Fri, Nov 11, 2011 at 10:14 AM, Chris Kaynor
> 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
2011/11/11 Terry Reedy
> On 11/10/2011 9:31 AM, Jerry Zhang wrote:
>
> Unfortunately there is a difference between composition and
>>aggregation in my real word, and my application really care this
>>since it is trying to simulate this real world model, so my system
>>should track
2011/11/11 Benjamin Kaplan
> On Thu, Nov 10, 2011 at 1:06 PM, Jerry Zhang
> wrote:
> >
> >
> > I just did an example code to describe what i am looking for.
> >
> /**/
> > # ...
> >
> > class Head:
>
On Fri, Nov 11, 2011 at 10:14 AM, Chris Kaynor 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 D
On Thu, Nov 10, 2011 at 2:48 PM, Steven D'Aprano
wrote:
> On Thu, 10 Nov 2011 14:38:58 -0500, Terry Reedy wrote:
>
>> I will point out that in the real world, dead donor transplants are
>> based on the fact the parts of the body do NOT have to die when the
>> composition does. I will not be surpri
On Thu, 10 Nov 2011 14:38:58 -0500, Terry Reedy wrote:
> I will point out that in the real world, dead donor transplants are
> based on the fact the parts of the body do NOT have to die when the
> composition does. I will not be surprised if we someday see arm
> transplants.
And Guido's Time Mach
Benjamin Kaplan wrote:
You're still misunderstanding Python's object model. del does NOT
delete an object. It deletes a name. The only way for an object to be
deleted is for it to be inaccessible (there are no references to it,
or there are no reachable references to it).
foo = object()
bar = fo
On 11/10/2011 9:31 AM, Jerry Zhang wrote:
Unfortunately there is a difference between composition and
aggregation in my real word, and my application really care this
since it is trying to simulate this real world model, so my system
should track this difference accurately, other
On Thu, Nov 10, 2011 at 1:06 PM, Jerry Zhang wrote:
>
>
> I just did an example code to describe what i am looking for.
> /**/
> # ...
>
> class Head:
> def __init__(self):
> self.size = 5
>
2011/11/11 Christian Heimes
> Am 10.11.2011 17:09, schrieb Tim Wintle:
> >> Meanwhile, I have a ZODB running, which stores all the living
> >> objects.
> >
> > The ZODB is append only and stores all objects. Deleting references to
> > an object (which would causes deletion of standard python obje
2011/11/11 Tim Wintle
> On Thu, 2011-11-10 at 22:25 +0800, Jerry Zhang wrote:
> >
> >
> > 2011/11/10 Chris Angelico
> > On Fri, Nov 11, 2011 at 12:58 AM, Jerry Zhang
> > wrote:
> > > Cls_a:
> > > def __init__(self):
> > > self.at1 = 1
> >
Am 10.11.2011 17:09, schrieb Tim Wintle:
>> Meanwhile, I have a ZODB running, which stores all the living
>> objects.
>
> The ZODB is append only and stores all objects. Deleting references to
> an object (which would causes deletion of standard python objects) won't
> delete it from the zodb, it
On Thu, 2011-11-10 at 22:25 +0800, Jerry Zhang wrote:
>
>
> 2011/11/10 Chris Angelico
> On Fri, Nov 11, 2011 at 12:58 AM, Jerry Zhang
> wrote:
> > Cls_a:
> > def __init__(self):
> > self.at1 = 1
> > Cls_b:
> > def __init__(
2011/11/10 Jerry Zhang
>
>
> 2011/11/10 Chris Angelico
>
>> On Fri, Nov 11, 2011 at 12:58 AM, Jerry Zhang
>> wrote:
>> > Cls_a:
>> > def __init__(self):
>> > self.at1 = 1
>> > Cls_b:
>> > def __init__(self):
>> > self.com1 = Cls_a()
>> > def __del__(self):
>> >
2011/11/10 Chris Angelico
> On Fri, Nov 11, 2011 at 12:58 AM, Jerry Zhang
> wrote:
> > Cls_a:
> > def __init__(self):
> > self.at1 = 1
> > Cls_b:
> > def __init__(self):
> > self.com1 = Cls_a()
> > def __del__(self):
> > del self.com1
> > Is it a right impleme
On Fri, Nov 11, 2011 at 12:58 AM, Jerry Zhang wrote:
> Cls_a:
> def __init__(self):
> self.at1 = 1
> Cls_b:
> def __init__(self):
> self.com1 = Cls_a()
> def __del__(self):
> del self.com1
> Is it a right implementation for composition?
Yes, except that you don
Hi Chris,
Firstly thanks for your quick reply.
1. Your code example gives a point, but i may not reach my question yet,
maybe because i did not make myself understood yet. Here is a more detail
example question.
I have a classes sets described by UML, which could be refered as Cls_A,
Cls_B, CLs_
On Fri, Nov 11, 2011 at 12:15 AM, Jerry Zhang wrote:
> For example, in composition model, the container object may be responsible
> for the handling of embedded objects' lifecycle. What is the python pattern
> of such implementation?
Here's an example:
class Test(object):
def __init__(self):
19 matches
Mail list logo