Re: Boxes of O's

2014-03-02 Thread Glazner
On Sunday, March 2, 2014 4:43:48 PM UTC+2, geni...@gmail.com wrote: > I agree with you and really appreciate your experience. But what I was > looking for is clues. Thank you anyway #not tested for i in range(n): for j in range(n*2): if i in (0, n - 1) or j in (0, n*2 - 1): print('o',

Re: Retrieving Python Keywords

2011-04-11 Thread Glazner
On Apr 10, 4:28 am, candide wrote: > Python is very good at introspection, so I was wondering if Python (2.7) > provides any feature to retrieve the list of its keywords (and, as, > assert, break, ...). >>> import keyword >>> keyword.kwlist ['and', 'as', 'assert', 'break', 'class', 'continue', 'd

Re: a better way to invert a list?

2011-04-06 Thread Glazner
> > def invert(p): > >     inverse = [None] * len(p) > >     for (i, j) in enumerate(p): > >         inverse[j] = i > >     return inverse > > Elegant. This seems like the best solution, although it isn't as much > fun to write as a "one-liner". Thanks >>> invert([1, 2, 3, 1]) [None, 3, 1, 2] #bl

Re: list 2 dict?

2011-01-03 Thread Glazner
On Jan 2, 3:18 pm, "Octavian Rasnita" wrote: > Hi, > > If I want to create a dictionary from a list, is there a better way than the > long line below? > > l = [1, 2, 3, 4, 5, 6, 7, 'a', 8, 'b'] > > d = dict(zip([l[x] for x in range(len(l)) if x %2 == 0], [l[x] for x in > range(len(l)) if x %2 ==

Re: Python Monitoring

2010-09-20 Thread Glazner
On Sep 20, 6:03 pm, de...@web.de (Diez B. Roggisch) wrote: > Glazner writes: > > Hi, > > > I'm will be writing a distributed program with parallel python and i > > would like to if there are any good monitoring utilities for python. > > I would like each remote

Python Monitoring

2010-09-20 Thread Glazner
ut it seems a bit outdated. any tips will be great! Many Thanks, Yoav Glazner -- http://mail.python.org/mailman/listinfo/python-list

Re: Distribute Non Library

2010-09-12 Thread Glazner
On Sep 12, 5:10 am, narke wrote: > My simple tool writing in python get bigger and bigger and I think I'd > better split my code into several files.  But, unlike what in some other > languages, there is no way to compile these several files into a single > executable. Before I splitting my simple

Re: Subclassing by monkey-patching

2010-09-06 Thread Glazner
On Sep 6, 11:08 am, Bruno Desthuilliers wrote: > Jason a écrit : > > > On Sep 5, 3:53 pm, Peter Otten <__pete...@web.de> wrote: > > m = gio.File(".").monitor_directory() > > C = type(m) > > > 'C' will not necessarily be 'gio.FileMonitor' — I think the internals > > of the GIO methods might

Re: sum for sequences?

2010-03-24 Thread Glazner
On Mar 24, 5:29 pm, kj wrote: > Is there a sequence-oriented equivalent to the sum built-in?  E.g.: > >   seq_sum(((1, 2), (5, 6))) --> (1, 2) + (5, 6) --> (1, 2, 5, 6) > > ? > > (By "sequence" I'm referring primarily to lists and tuples, and > excluding strings, since for these there is ''.join()

Advice needed on parallel processing in python

2010-03-24 Thread Glazner
his system with python. I already use win32all and read about Pareller Python and Pyro. a requirement is that messages can be sent to the remote worker. If anyone can share experience I'll love to hear Many Thanks, Yoav Glazner -- http://mail.python.org/mailman/listinfo/python-list

Re: how to start a python script only once

2010-03-14 Thread Glazner
On Mar 13, 8:45 pm, News123 wrote: > Hi, > > I'd like to make sure, that a certain python program will only be run > once per host. (linux/windows) > > so if the program is started a second time it should just terminate and > let the other one run. > > This does not have to be the fastest solution

an't start a thread Pool from another thread

2010-01-06 Thread Glazner
Hi all, I hope someone can help me with this issue I see that i can't start a thread Pool from another thread, why? running python 2.6.4 windowsXP >>> import multiprocessing.dummy as threads >>> def makePool(): threads.Pool(3) >>> makePool() >>> import thread >>> thread.start_new(makePool

Re: multiprocessing module

2009-12-31 Thread Glazner
On Dec 15 2009, 10:56 am, makobu wrote: > I have a function that makes two subprocess.Popen() calls on a file. > > I have 8 cores. I need 8 instances of that function running in > parallel at any given time till all the files are worked on. > Can the multiprocessing module do this? If so, whats th

Re: PySerial and termios

2009-11-30 Thread Glazner
On Nov 30, 7:41 pm, Grant Edwards wrote: > On 2009-11-30, a b wrote: > > > I have a pain in the a** problem with pyserial- it works 90% > > of time but on the 10% of time it thorows and termios.error > > exception with the value (5, 'Input/output error') and i > > cannot get rid of it :( > > Soun