Re: OS.SYSTEM ERROR !!!

2008-09-30 Thread giltay
On Sep 30, 1:21 pm, "Blubaugh, David A." <[EMAIL PROTECTED]> wrote: > I would usually execute this program (with the appropriate arguments) by > going to following directory within MS-DOS (Windows XP): > > C:\myprogramfolder\run> Myprogram.exe 1 1 acc 0 [snip] > import os > > os.system(r"C:\myprogr

Re: improving a huge double-for cycle

2008-09-19 Thread giltay
On Sep 18, 7:42 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I'm not being snarky about losing priority here, but I submitted > essentially the same solution two hours earlier than pruebono. My apologies (seriosuly). In this case, I think it might just be haste. For what i

Re: Blanket font setting?

2008-09-18 Thread giltay
On Sep 18, 12:55 pm, RGK <[EMAIL PROTECTED]> wrote: > Is there any sort of blanket font setting, perhaps like: > >    wx.SystemSettings_SetFont(font)   #this doesn't exist > > that could set everything with one fell swoop? > > Thanks for your attention... > > Ross. I do this by setting the font in

Re: improving a huge double-for cycle

2008-09-18 Thread giltay
On Sep 18, 11:18 am, [EMAIL PROTECTED] wrote: > dup=set() > SN=[] > for item in IN: >    c=item.coordinates[0], item.coordinates[1] >    if c in dup: >       SN.append(item.label) >    else: >       dup.add(c) +1 for O(N) If item.coordinates is just an (x, y) pair, you can skip building c and sav

Re: Run program from within Python

2008-08-06 Thread giltay
On Aug 6, 3:42 pm, frankrentef <[EMAIL PROTECTED]> wrote: > stdout, stdin = popen2.popen2('c:\test\OpenProgram.exe 1 1') What Mike said about subprocess. Also, in regular Python strings, \t means a tab character. You need to replace \ with \\ in the programme path ('c:\\test\\OpenProgram.exe 1 1

Re: iterating "by twos"

2008-07-30 Thread giltay
On Jul 29, 4:11 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > for x, y in zip(a, a[1:]): > >     frob(x, y) > > What you meant was this: > >  >>> [(x, y) for x, y in zip(a[::2], a[1::2])] > [(0, 1), (2, 3), (4, 5), (6, 7), (8, 9)] > > but this creates three sublists

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread giltay
On Jul 30, 5:09 am, Maric Michaud <[EMAIL PROTECTED]> wrote: > Le Tuesday 29 July 2008 23:48:31 [EMAIL PROTECTED], vous avez écrit : > > def print_members(iterable): > >     if not iterable: > >         print '' > >         return > >     print '' > >     for item in iterable: > >         print '%s

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread giltay
On Jul 29, 1:30 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jul 29, 5:15 am, Heiko Wundram <[EMAIL PROTECTED]> wrote: > > > I can't dig up a simple example from code I wrote quickly, but because of > > the > > fact that explicit comparisons always hamper polymorphism > > I'm not going to take y

Re: iterating "by twos"

2008-07-29 Thread giltay
On Jul 29, 2:36 pm, [EMAIL PROTECTED] wrote: > On Jul 29, 1:36 pm, kj <[EMAIL PROTECTED]> wrote: > > > Is there a special pythonic idiom for iterating over a list (or > > tuple) two elements at a time? > >      I use this one a lot: > > for x, y in zip(a, a[1:]): >     frob(x, y) > > Geoff G-T

Re: iterating "by twos"

2008-07-29 Thread giltay
On Jul 29, 1:36 pm, kj <[EMAIL PROTECTED]> wrote: > Is there a special pythonic idiom for iterating over a list (or > tuple) two elements at a time? I use this one a lot: for x, y in zip(a, a[1:]): frob(x, y) Geoff G-T -- http://mail.python.org/mailman/listinfo/python-list

Re: Producer-consumer threading problem

2008-06-11 Thread giltay
> Sounds like a sentinel would work for this. The producer puts a > specific object (say, None) in the queue and the consumer checks for > this object and stops consuming when it sees it. But that seems so > obvious I suspect there's something else up. There's a decent implementation of thi

Re: accessing class attributes

2008-05-28 Thread giltay
On May 28, 12:09 pm, eliben <[EMAIL PROTECTED]> wrote: > Hello, > > I have a game class, and the game has a state. Seeing that Python has > no enumeration type, at first I used strings to represent states: > "paused", "running", etc. But such a representation has many > negatives, so I decided to l