Re: Python bug in Windows 8--report now, or later?

2011-09-17 Thread Alec Taylor
On Sun, Sep 18, 2011 at 2:40 PM, Westley Martínez wrote: > On Sun, Sep 18, 2011 at 04:15:57AM +, Grant Edwards wrote: >> On 2011-09-17, Chris Angelico wrote: >> >> > I would consider reporting it as a bug in Windows 8, not a bug in >> > >> >> Good luck with that plan.  ;) >> >> [I don't kno

Re: Python bug in Windows 8--report now, or later?

2011-09-17 Thread Westley Martínez
On Sun, Sep 18, 2011 at 04:15:57AM +, Grant Edwards wrote: > On 2011-09-17, Chris Angelico wrote: > > > I would consider reporting it as a bug in Windows 8, not a bug in > > Good luck with that plan. ;) > > [I don't know anything about this particular issue, but I do know that > when ther

Re: Python bug in Windows 8--report now, or later?

2011-09-17 Thread Grant Edwards
On 2011-09-17, Chris Angelico wrote: > I would consider reporting it as a bug in Windows 8, not a bug in Good luck with that plan. ;) [I don't know anything about this particular issue, but I do know that when there is a bug in Windows, it's usually everyboyd else that has to change to work a

Re: Python bug in Windows 8--report now, or later?

2011-09-17 Thread John Ladasky
On Sep 17, 2:20 pm, Chris Angelico wrote: > I would consider reporting it as a bug in Windows 8, not a bug in Python. > > Chris Angelico +1, beat me to it. :^) -- http://mail.python.org/mailman/listinfo/python-list

Re: os independent rename

2011-09-17 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Nobody wrote: On Sat, 17 Sep 2011 20:28:32 +0430, Lee Harr wrote: So, what is the best way to do this that will behave the same across operating systems? Delete the destination first, but after checking that it isn't the same as the source. On Windows, that last bit

Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-17 Thread MRAB
On 18/09/2011 00:26, Dennis Lee Bieber wrote: On Sun, 18 Sep 2011 07:35:01 +1000, Chris Angelico declaimed the following in gmane.comp.python.general: Is it just that nobody's implemented it, or is there a good reason for avoiding offering this sort of thing? Any asynchronous "kill" r

Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-17 Thread Chris Angelico
On Sun, Sep 18, 2011 at 9:26 AM, Dennis Lee Bieber wrote: > def threadWork(lock, a1, a2, rate): >        while True: >                time.sleep(rate) >                lock.lock() >                t = a2.balance / 2 >                a1.balance += t >                #say a thread.kill kills at this

Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-17 Thread Terry Reedy
On 9/17/2011 7:19 PM, Chris Angelico wrote: On Sun, Sep 18, 2011 at 8:27 AM, Chris Rebert wrote: It's possible that the reason is analogous to why Java has deprecated its equivalent, Thread.stop(): http://download.oracle.com/javase/1.4.2/docs/guide/misc/threadPrimitiveDeprecation.html Interes

Re: os independent rename

2011-09-17 Thread Cameron Simpson
On 17Sep2011 20:18, Nobody wrote: | On Sat, 17 Sep 2011 20:28:32 +0430, Lee Harr wrote: | > So, what is the best way to do this that will | > behave the same across operating systems? | | Delete the destination first, but after checking that it isn't the same as | the source. This is usually a s

Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-17 Thread Cameron Simpson
On 17Sep2011 15:27, Chris Rebert wrote: | On Sat, Sep 17, 2011 at 2:35 PM, Chris Angelico wrote: | > On Sun, Sep 18, 2011 at 5:00 AM, Nobody wrote: | >> The only robust solution is to use a separate process (threads won't | >> suffice, as they don't have a .kill() method). | > | > Forking a thre

Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-17 Thread Chris Angelico
On Sun, Sep 18, 2011 at 8:27 AM, Chris Rebert wrote: > It's possible that the reason is analogous to why Java has deprecated > its equivalent, Thread.stop(): > http://download.oracle.com/javase/1.4.2/docs/guide/misc/threadPrimitiveDeprecation.html Interesting. The main argument against having a w

Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-17 Thread Chris Rebert
On Sat, Sep 17, 2011 at 2:35 PM, Chris Angelico wrote: > On Sun, Sep 18, 2011 at 5:00 AM, Nobody wrote: >> The only robust solution is to use a separate process (threads won't >> suffice, as they don't have a .kill() method). > > Forking a thread to discuss threads ahem. > > Why is it that th

Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-17 Thread Chris Angelico
On Sun, Sep 18, 2011 at 5:00 AM, Nobody wrote: > The only robust solution is to use a separate process (threads won't > suffice, as they don't have a .kill() method). > Forking a thread to discuss threads ahem. Why is it that threads can't be killed? Do Python threads correspond to OS-provid

Re: Python bug in Windows 8--report now, or later?

2011-09-17 Thread Chris Angelico
On Sun, Sep 18, 2011 at 4:01 AM, Kevin Walzer wrote: > I realize that this developer preview of Windows is still at somewhere > between alpha- and beta-level, and it's possible things will get better. > Should I wait to report this as a bug until Windows 8 is released, or do the > Python developer

Re: Python bug in Windows 8--report now, or later?

2011-09-17 Thread Terry Reedy
On 9/17/2011 2:01 PM, Kevin Walzer wrote: I have been testing my Python application on the just-released developer preview of Windows 8 and have noted an error: the application does not create an app folder in the user's "application data" directory. This causes the app to crash on startup. Manua

Re: os independent rename

2011-09-17 Thread Nobody
On Sat, 17 Sep 2011 20:28:32 +0430, Lee Harr wrote: > So, what is the best way to do this that will > behave the same across operating systems? Delete the destination first, but after checking that it isn't the same as the source. On Windows, that last bit is harder than it seems. A string-based

Re: Cancel or timeout a long running regular expression

2011-09-17 Thread Nobody
On Fri, 16 Sep 2011 18:01:27 -0400, Terry Reedy wrote: > Now, can you write that as a heuristic *algorithm* > def dangerous_re(some_re):? return re.search(r'\\\d', some_re) is not None That will handle the most extreme case ;) If the OP is serious about analysing regexps, sre_parse.pars

Re: os independent rename

2011-09-17 Thread Lee Harr
> shutil.move works for me, at least in Python 2.7. The docstring> doesn't > seem to match the code Thanks for checking that. Looks like there is a closed report about the misleading docs:http://bugs.python.org/issue12577 Closed a couple of months ago, but the docs have not madeit to the web ye

Python bug in Windows 8--report now, or later?

2011-09-17 Thread Kevin Walzer
I have been testing my Python application on the just-released developer preview of Windows 8 and have noted an error: the application does not create an app folder in the user's "application data" directory. This causes the app to crash on startup. Manually creating the directory solves the pr

Re: way to calculate 2**1000 without expanding it?

2011-09-17 Thread Grant Edwards
On 2011-09-17, Ian Kelly wrote: > On Fri, Sep 16, 2011 at 8:19 PM, Grant Edwards > wrote: >>> Here's another one-liner using a generator instead of map: >>> >>> ? ? ?sum(int(c) for c in str(2**1000)) >> >> Just in case you can't spare the 3KB required for the list of integers >> that map creates

Re: os independent rename

2011-09-17 Thread Ian Kelly
On Sat, Sep 17, 2011 at 9:58 AM, Lee Harr wrote: > > I just got a bug report the heart of which is the > difference between unix and windows in using > os.rename > > (ie, "On Windows, if dst already exists, OSError will be raised") > > Hmm, I thought, maybe I'm supposed to use > shutil here. That

os independent rename

2011-09-17 Thread Lee Harr
I just got a bug report the heart of which is the difference between unix and windows in using os.rename (ie, "On Windows, if dst already exists, OSError will be raised") Hmm, I thought, maybe I'm supposed to use shutil here. That is the "high-level" operations. Unfortunately, shutil.move says i

Re: strange results

2011-09-17 Thread Anssi Saari
Fig writes: > My OS is Windows 7, Python 2.7.2, I downloaded and installed the > python-gasp-0.2.0beta1.win32.exe file, and I also have these > installed: Python 2.7 pygame-1.9.2a0 and Python 2.7 pywin32-216 Then maybe that old beta version is your problem? For the record, your code works for me

Modifiying __getattribute__ of an instance

2011-09-17 Thread Yaşar Arabacı
I am trying to modify __getattribute__() method for an instance, as you may already know,__getattirbute__ is read-only attribute in Python. What I have in mind is, create a new object like this: def create_new_instace(old_instance): class temp(old_instance.__class__): def __init__(self

Re: strange results

2011-09-17 Thread Fig
On Sep 17, 1:59 am, Alexander Kapps wrote: > On 17.09.2011 01:09, Fig wrote: > > > I took out all of the color commands that were in the shape functions > > and all of the features to the 'draw_house' function showed showed up. > > I started putting the color commands back into the shape functions

Re: Code Review

2011-09-17 Thread Emeka
Philipp, Thanks so much for your time and comment. I will re-work my code accordingly. Regards, Emeka On Sat, Sep 17, 2011 at 12:19 PM, Philipp Hagemeister wrote: > Instead of comments, you can often use docstrings > (http://www.python.org/dev/peps/pep-0257/ ): > > This is hard to read due to t

Re: create a directory structure

2011-09-17 Thread Rafael Durán Castañeda
2011/9/16 Andrea Crotti > After some research, I think that paste-script is the best choice in this > case. > > I can define templates and I'll get my directory structure nicely populated > for me. > > -- > http://mail.python.org/**mailman/listinfo/python-list

Re: Code Review

2011-09-17 Thread Philipp Hagemeister
Instead of comments, you can often use docstrings (http://www.python.org/dev/peps/pep-0257/ ): This is hard to read due to the indentation, and cannot be accessed programmatically: #Update the GUI def update_gui(self, new_word): Instead, use this: def update_gui(self, new_word):

Re: multiprocessing.Pool, its queue, and pre-emption

2011-09-17 Thread John Ladasky
Hey, this pretty easy hack appears to work! [code] from multiprocessing.pool import Pool, RUN, MapResult, mapstar class PriorityPool(Pool): def map_async_nowait(self, func, iterable, chunksize=None, \ callback=None): """ Same as map_async(), except uses put_nowait()

Re: Accessing matplotlib-users discussion group?

2011-09-17 Thread John Ladasky
On Sep 16, 10:29 am, Martin Schöön wrote: > On 2011-09-15, John Ladasky wrote: > > > Hate to bump this, but... I found Sourceforge's IRC, and tried to ask > > for help there, and it doesn't look like I can get any help until > > business hours tomorrow.  Anyone? > > No help really but I 'joined'

Re: strange results

2011-09-17 Thread Alexander Kapps
On 17.09.2011 01:09, Fig wrote: I took out all of the color commands that were in the shape functions and all of the features to the 'draw_house' function showed showed up. I started putting the color commands back into the shape functions and have no problems with some of them but when I put the