Re: Order a list to get a hierarchical order

2012-06-08 Thread Thibaut DIRLIK
Thanks for your help, I'll test this. 2012/6/8 Peter Otten <__pete...@web.de> > Ivars Geidans wrote: > > > def append_node(n, l, ls): > > ls.append(n) > > for c in [nc for nc in l if nc.parent is n]: > > append_node(c, l, ls) > > return ls > > > > def sort_nodes(l): > > ls

Order a list to get a hierarchical order

2012-06-08 Thread Thibaut DIRLIK
Hi, Having a list of objet with a parent_id attribute pointing to a parent, I want to order this list like this : [Parent #1, Child #1.1, Child#1.1.1, Child#1.1.2, Child#1.2, Parent #2, Child #2.1, ...] Any clue on how to do this ? Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Working with dates : complex problem

2012-05-24 Thread Thibaut DIRLIK
Hi, I've a list of python objects with dates attributes. This list is ordered by one of these date. Elements mandatory follow each other : Element #1 Element #2 Element #3 |-|--|--| Now, I want to "insert" an

Sockets accept() in child processes

2012-04-12 Thread Thibaut DIRLIK
Hi, I'm writing a multiprocess server with Python 3.2 and the multiprocessing module. Here is my current implementation : - Main process: select() on a list of server sockets (different ips of the host, ssl or not, etc) - Children process : When they get a signal (in fact, a message in a pipe), t

Multiprocessing & Logging

2012-04-07 Thread Thibaut DIRLIK
Hi, I'm currently writing a multiprocess applications with Python 3.2 and multiprocessing module. My subprocesses will use a QueueHandler to log messages (by sending them to the main process, which uses a QueueListener). However, if logging is already configured when I create the subprocesses, the