CocosNode.get_children() order

9 views
Skip to first unread message

Nitneroc

unread,
Aug 6, 2012, 3:17:29 PM8/6/12
to cocos-...@googlegroups.com
Hi !
The few tests I did seem to indicate that get_children() will return the list in the order the children were created, if they are at the same z value.
Do you think I can rely on this, or does it seem too unsure to you ?
There is nothing about this on documentation, so I looked at the code, and it uses bisect.insort_right, which preserves order, so I guess it's ok, but maybe some of you know something I should be aware of.
Thank you for reading

claudio canepa

unread,
Aug 6, 2012, 3:34:14 PM8/6/12
to cocos-...@googlegroups.com
On Mon, Aug 6, 2012 at 4:17 PM, Nitneroc <corent...@gmail.com> wrote:
Hi !
The few tests I did seem to indicate that get_children() will return the list in the order the children were created, if they are at the same z value.
Do you think I can rely on this, or does it seem too unsure to you ?

I think you can rely on this. As you have seen, the code ensures that, and there are no plan to change that code.
 
There is nothing about this on documentation, so I looked at the code, and it uses bisect.insort_right, which preserves order, so I guess it's ok, but maybe some of you know something I should be aware of.
Thank you for reading
--

 

Nitneroc

unread,
Aug 7, 2012, 5:09:44 AM8/7/12
to cocos-...@googlegroups.com
I was afraid some other part of the code could modify this behaviour.
Thanks for your help.
Reply all
Reply to author
Forward
0 new messages