Terry Reedy writes:
> Indexing objects by their internal id is usually useless.
obj.id is not the internal id.
--
Piet van Oostrum
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
--
http://mail.python.org/mailman/listinfo/python-list
On 9/5/2011 9:15 AM, Kristofer Tengström wrote:
Thanks everyone, moving the declaration to the class's __init__ method
did the trick. Now there's just one little problem left. I'm trying to
create a list that holds the parents for each instance in the
hierarchy. This is what my code looks like no
Jon Clements wrote:
> I
> must say I'm not 100% sure what the OP wants to achieve...
Learn Python?
;)
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 5, 3:43 pm, Peter Otten <__pete...@web.de> wrote:
> Kristofer Tengström wrote:
> > Thanks everyone, moving the declaration to the class's __init__ method
> > did the trick. Now there's just one little problem left. I'm trying to
> > create a list that holds the parents for each instance in t
Thanks everyone, moving the declaration to the class's __init__ method
did the trick. Now there's just one little problem left. I'm trying to
create a list that holds the parents for each instance in the
hierarchy. This is what my code looks like now:
-
cla
Kristofer Tengström wrote:
> Thanks everyone, moving the declaration to the class's __init__ method
> did the trick. Now there's just one little problem left. I'm trying to
> create a list that holds the parents for each instance in the
> hierarchy. This is what my code looks like now:
>
> --
Hi,
You are getting same object because you are overriding the dictionary
update.
Its printing the proper value with the last updated instance of B.
If you want to see the two different instances of class B give print
self.sub inside the sub_add method in class A.
CHEERS
CNA
9986229891
On Mon,
Kristofer Tengström writes:
> Hi, I'm having trouble creating objects that in turn can have custom
> objects as variables.
That terminology is rather confused.
I think what you want is to have instances with their own attributes.
> class A:
> sub = dict()
This binds a single object (a new
Kristofer Tengström wrote:
> Hi, I'm having trouble creating objects that in turn can have custom
> objects as variables. The code looks like this:
>
> -
>
> class A:
> sub = dict()
Putting it into the class like this means sub is shared by all in
On 9/4/11 11:47 PM, Kristofer Tengström wrote:
> Hi, I'm having trouble creating objects that in turn can have custom
> objects as variables. The code looks like this:
>
> -
>
> class A:
> sub = dict()
You are sharing this single "sub" dictionary w
10 matches
Mail list logo