Re: Interesting problem about uuid1

2011-11-21 Thread alex23
On Nov 21, 5:33 pm, sword wrote: > My colleague asks me an interesting problem about uuid library in > python. In multicore system with multiprocessing, is it possible to > get the duplicated uuid with uuid1? > > I just check the RFC 4122, and I can't find anything about multicore > environment. P

Re: Interesting Problem

2010-01-20 Thread alex23
Victor Subervi wrote: > I think I finally have an interesting problem for y'all. I need to import a > script from a lower dir, forcing me to change dirs: I'm surprised that no one has yet mentioned packages. Suppose you have the following folder layout and you stick an empty __init__.py in each s

Re: Interesting Problem

2010-01-20 Thread M.-A. Lemburg
Victor Subervi wrote: > Hi; > I think I finally have an interesting problem for y'all. I need to import a > script from a lower dir, forcing me to change dirs: > > cwd = os.getcwd() > os.chdir('%s/..' % cwd) > sys.path.append(os.getcwd()) > from templateFrame import top, bottom > os.chdir(cwd) I

Re: Interesting Problem

2010-01-20 Thread MRAB
James Matthews wrote: Also as a side point... It's best to anonymize the code as best you can so people cannot attach your code to your site (IP theft and security risk) [snip] Security risk, yes; IP theft, not so much. ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Interesting Problem

2010-01-20 Thread Victor Subervi
On Wed, Jan 20, 2010 at 12:30 PM, Stephen Hansen wrote: > On Wed, Jan 20, 2010 at 7:19 AM, Victor Subervi > wrote: > >> Hi; >> I think I finally have an interesting problem for y'all. I need to import >> a script from a lower dir, forcing me to change dirs: >> > > Don't do that. If you must, then

Re: Interesting Problem

2010-01-20 Thread James Matthews
Also as a side point... It's best to anonymize the code as best you can so people cannot attach your code to your site (IP theft and security risk) On Wed, Jan 20, 2010 at 8:38 AM, MRAB wrote: > Victor Subervi wrote: > >> Hi; >> I think I finally have an interesting problem for y'all. I need to

Re: Interesting Problem

2010-01-20 Thread Gary Herron
Victor Subervi wrote: Hi; I think I finally have an interesting problem for y'all. I need to import a script from a lower dir, forcing me to change dirs: Wait a moment... Your assumption that you need to change directories is invalid. (And that means everything you do below this point unnec

Re: Interesting Problem

2010-01-20 Thread MRAB
Victor Subervi wrote: Hi; I think I finally have an interesting problem for y'all. I need to import a script from a lower dir, forcing me to change dirs: cwd = os.getcwd() os.chdir('%s/..' % cwd) sys.path.append(os.getcwd()) from templateFrame import top, bottom os.chdir(cwd) There's no need

Re: Interesting Problem

2010-01-20 Thread Stephen Hansen
On Wed, Jan 20, 2010 at 7:19 AM, Victor Subervi wrote: > Hi; > I think I finally have an interesting problem for y'all. I need to import a > script from a lower dir, forcing me to change dirs: > Don't do that. If you must, then the correct way to do it is to adjust your sys.path and not change di

Re: Interesting (?) problem

2010-01-11 Thread Nobody
On Mon, 11 Jan 2010 18:57:24 +0100, mk wrote: >> I have two lists of IP addresses: >> >> hostips = [ 'a', 'b', 'c', 'd', 'e' ] >> >> thread_results = [ 'd', 'b', 'c' ] >> >> I need to sort thread_results in the same order as hostips. > > P.S. One clarification: those lists are actually more co

Re: Interesting (?) problem

2010-01-11 Thread Paul Rubin
mk writes: > I have two lists of IP addresses: > > hostips = [ 'a', 'b', 'c', 'd', 'e' ] > > thread_results = [ 'd', 'b', 'c' ] > > I need to sort thread_results in the same order as hostips. Assuming each address in hostips appears just once: from itertools import izip,count d = dict(iz

Re: Interesting (?) problem

2010-01-11 Thread Peter Otten
mk wrote: > mk wrote: >> Hello everyone, >> >> I have two lists of IP addresses: >> >> hostips = [ 'a', 'b', 'c', 'd', 'e' ] >> >> thread_results = [ 'd', 'b', 'c' ] >> >> I need to sort thread_results in the same order as hostips. > > P.S. One clarification: those lists are actually more com

Re: Interesting (?) problem

2010-01-11 Thread Jean-Michel Pichavant
mk wrote: mk wrote: Hello everyone, I have two lists of IP addresses: hostips = [ 'a', 'b', 'c', 'd', 'e' ] thread_results = [ 'd', 'b', 'c' ] I need to sort thread_results in the same order as hostips. P.S. One clarification: those lists are actually more complicated (thread_result is a

Re: Interesting (?) problem

2010-01-11 Thread Arnaud Delobelle
mk writes: > Hello everyone, > > I have two lists of IP addresses: > > hostips = [ 'a', 'b', 'c', 'd', 'e' ] > > thread_results = [ 'd', 'b', 'c' ] > > I need to sort thread_results in the same order as hostips. [...solution:] > hostips_limited = [] > for h in hostips: > if h in thread_resul

Re: Interesting (?) problem

2010-01-11 Thread mk
mk wrote: Hello everyone, I have two lists of IP addresses: hostips = [ 'a', 'b', 'c', 'd', 'e' ] thread_results = [ 'd', 'b', 'c' ] I need to sort thread_results in the same order as hostips. P.S. One clarification: those lists are actually more complicated (thread_result is a list of tup

Re: Interesting (?) problem

2010-01-11 Thread Jean-Michel Pichavant
mk wrote: Incidentally, it *seems* that list comprehension preserves order: hostips_limited = [ h for h in hostips if h in thread_results ] Empirically speaking it seems to work (I tested it on real ips), but please correct me if that's wrong. Regards, mk Sounds good to me. List are *o