Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-21 Thread Nick Coghlan
Brett Cannon wrote: > On Tue, Oct 20, 2009 at 07:57, Mark Dickinson > wrote: > The Deccoeff type is very simple, though. It would be easy to create > a pure Python version of it, and then do something like: > > try: >from _decimal import Deccoeff #

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-20 Thread Brett Cannon
On Tue, Oct 20, 2009 at 07:57, Mark Dickinson wrote: > On Tue, Oct 20, 2009 at 3:50 PM, Eric Smith wrote: > >> The code was working a few months ago (with all Decimal tests > >> passing), but there have been some changes and bugfixes since > >> then. I might try to resurrect that code, dropping

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-20 Thread Mark Dickinson
On Tue, Oct 20, 2009 at 3:50 PM, Eric Smith wrote: >> The code was working a few months ago (with all Decimal tests >> passing), but there have been some changes and bugfixes since >> then.  I might try to resurrect that code, dropping the _Decimal type and >> just concentrating on Deccoeff. > > M

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-20 Thread Eric Smith
> On Tue, Oct 20, 2009 at 11:49 AM, Nick Coghlan wrote: >> Mark Dickinson wrote: >>> This high-precision inefficiency could easily be fixed by >>> using a dedicated 'decimal natural number' extension >>> type for the Decimal coefficient, stored internally in base >>> a suitable power of 10. [...]

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-20 Thread Mark Dickinson
On Tue, Oct 20, 2009 at 11:49 AM, Nick Coghlan wrote: > Mark Dickinson wrote: >> This high-precision inefficiency could easily be fixed by >> using a dedicated 'decimal natural number' extension >> type for the Decimal coefficient, stored internally in base >> a suitable power of 10. [...] > > Did

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-20 Thread Nick Coghlan
Mark Dickinson wrote: > This high-precision inefficiency could easily be fixed by > using a dedicated 'decimal natural number' extension > type for the Decimal coefficient, stored internally in base > a suitable power of 10. I think this may be worth > considering seriously. I'm not proposing this

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-20 Thread Mark Dickinson
On Mon, Oct 19, 2009 at 9:58 PM, Tim Peters wrote: > Don't want to hijack this thread, but this is the kind of use case > justifying keeping the 3-argument pow in the decimal module.  People > "playing" with number theory questions can learn a bag of tricks to > worm around that non-decimal arithm

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-19 Thread Tim Peters
[Mark Dickinson] > By the way, here's an example of an *almost* real-life use of million digit > calculations. > > For an elementary number theory course that I taught a while ago, there > was an associated (optional) computer lab, where the students used > Python to investigate various ideas, conj

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-19 Thread Mark Dickinson
On Sun, Oct 18, 2009 at 9:01 PM, Antoine Pitrou wrote: > Can we remove this check, or are there people doing million-digits > calculations > they want to interrupt using Control-C ? By the way, here's an example of an *almost* real-life use of million digit calculations. For an elementary numb

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-19 Thread Mark Dickinson
On Sun, Oct 18, 2009 at 11:46 PM, Antoine Pitrou wrote: > Sure, but it's no different than doing, e.g.: >    list(range(1)).sort() > > (don't try this, it just made by computer slow down to a crawl and I had to > kill > -9 the Python interpreter) Maybe you were running out of RAM? On a

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-18 Thread Daniel Stutzbach
On Sun, Oct 18, 2009 at 5:46 PM, Antoine Pitrou wrote: > Daniel Stutzbach stutzbachenterprises.com> writes: > > I sometimes do million-digits calculations that I want to interrupt using > Control-C.(particularly when I didn't *intend* to do a million-digits > calculation... ;) )-- > > Sure, but

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-18 Thread Antoine Pitrou
Daniel Stutzbach stutzbachenterprises.com> writes: > > I sometimes do million-digits calculations that I want to interrupt using Control-C.(particularly when I didn't *intend* to do a million-digits calculation... ;) )-- Sure, but it's no different than doing, e.g.: list(range(1)).so

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-18 Thread Daniel Stutzbach
On Sun, Oct 18, 2009 at 3:01 PM, Antoine Pitrou wrote: > Can we remove this check, or are there people doing million-digits > calculations > they want to interrupt using Control-C ? > I sometimes do million-digits calculations that I want to interrupt using Control-C. (particularly when I didn'

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-18 Thread Antoine Pitrou
Mark Dickinson gmail.com> writes: > > Yes, I suspect there are. Though you don't need millions of digits for a single > operation to take a noticeable amount of time: try str(10**10), > for example. > > Is there a benefit to removing the check? Apart from casual cleanup, the reason I'm as

Re: [Python-Dev] SIGCHECK() in longobject.c

2009-10-18 Thread Mark Dickinson
On Sun, Oct 18, 2009 at 9:01 PM, Antoine Pitrou wrote: > In Objects/longobject.c, there's the SIGCHECK() macro which periodically > checks > for signals when doing long integer computations (divisions, multiplications). > It does so by messing with the _Py_Ticker variable. > > It was added in 19

[Python-Dev] SIGCHECK() in longobject.c

2009-10-18 Thread Antoine Pitrou
Hello, In Objects/longobject.c, there's the SIGCHECK() macro which periodically checks for signals when doing long integer computations (divisions, multiplications). It does so by messing with the _Py_Ticker variable. It was added in 1991 under the title "Many small changes", and I suppose it wa