Re: [Python-Dev] Problem with signals in a single threaded application

2007-01-23 Thread Martin v. Löwis
Ulisses Furquim schrieb: > I've read some threads about signals in the archives and I was under > the impression signals should work reliably on single-threaded > applications. Am I right? I've thought about a way to fix this, but I > don't know what is the current plan for signals support in pyth

Re: [Python-Dev] compex numbers (was Floor Division)

2007-01-23 Thread Andrew Koenig
> If "real" and "imag" are themselves complex numbers, then normalizing > the result will move the imaginary portion of the "real" vector into > the imaginary part and vice versa. Not quite. >>> complex(1,1j) 0j >>> complex(0,1j) (-1+0j) So it moves the imaginary portion of the "imag" argument i

Re: [Python-Dev] Problem with signals in a single threaded application

2007-01-23 Thread Aahz
On Tue, Jan 23, 2007, Ulisses Furquim wrote: > > I've read some threads about signals in the archives and I was under > the impression signals should work reliably on single-threaded > applications. Am I right? I've thought about a way to fix this, but I > don't know what is the current plan for s

Re: [Python-Dev] Object creation hook

2007-01-23 Thread Martin v. Löwis
Kristján V. Jónsson schrieb: > I am trying to insert a hook into python enabling a callback for all > just-created objects. The intention is to debug and find memory leaks, > e.g. by having the hook function insert the object into a WeakKeyDictionary. I'd like to point out that this isn't a pytho

Re: [Python-Dev] Floor division

2007-01-23 Thread Gareth McCaughan
On Tuesday 23 January 2007 07:01, Tim Peters wrote: > complex_new() ends with: > > cr.real -= ci.imag; > cr.imag += ci.real; > > and I have no idea what that thinks it's doing. Surely this isn't intended?!: > >>> complex(complex(1.0, 2.0), complex(10.0, 20.0)) > > (-19+12j) > > WTF?

Re: [Python-Dev] Object creation hook

2007-01-23 Thread Steve Holden
Kristján V. Jónsson wrote: > Hello there. > > I am trying to insert a hook into python enabling a callback for all > just-created objects. The intention is to debug and find memory leaks, > e.g. by having the hook function insert the object into a WeakKeyDictionary. > > I have already added a

Re: [Python-Dev] Floor division

2007-01-23 Thread Tim Peters
[Armin] >>> BTW - isn't that case in contradiction with the general Python rule that >>> if b > 0, then a % b should return a number between 0 included and b >>> excluded? [Tim] >> Sure. [Armin] > You're not addressing my point, though, so I was probably not clear > enough. "Sure" is the answer

Re: [Python-Dev] Object creation hook

2007-01-23 Thread Mike Klaas
On 1/23/07, Kristján V. Jónsson <[EMAIL PROTECTED]> wrote: > Hello there. > > I am trying to insert a hook into python enabling a callback for all > just-created objects. The intention is to debug and find memory leaks, e.g. > by having the hook function insert the object into a WeakKeyDictionary

[Python-Dev] compex numbers (was Floor Division)

2007-01-23 Thread Nick Maclaren
"Jim Jewett" <[EMAIL PROTECTED]> wrote: > Tim Peters wrote: > > > complex_new() ends with: > > > cr.real -= ci.imag; > > cr.imag += ci.real; > > > and I have no idea what that thinks it's doing. Surely this isn't > > intended?! > : > > I think it is. python.org/sf/1642844 adds c

[Python-Dev] compex numbers (was Floor Division)

2007-01-23 Thread Jim Jewett
Tim Peters wrote: > complex_new() ends with: > cr.real -= ci.imag; > cr.imag += ci.real; > and I have no idea what that thinks it's doing. Surely this isn't intended?!: I think it is. python.org/sf/1642844 adds comments to make it less unclear. > >>> complex(complex(1.0, 2.0),

[Python-Dev] Problem with signals in a single threaded application

2007-01-23 Thread Ulisses Furquim
Hi, I'm aware of the problems with signals in a multithreaded application, but I was using signals in a single-threaded application and noticed something that seemed wrong. Some signals were apparently being lost, but when another signal came in the python handler for that "lost" signal was being

[Python-Dev] Floor division

2007-01-23 Thread Nick Maclaren
"Jim Jewett" <[EMAIL PROTECTED]> wrote: > > >... I can work with and teach almost any model, > > and have done so with some pretty weird ones. > > I think python's model is "Whatever your other tools use. Ask them." > And I think that is a reasonable choice. Answer: It's undefined. Just because

[Python-Dev] Floor division

2007-01-23 Thread Jim Jewett
Nick Maclaren wrote: >... I can work with and teach almost any model, > and have done so with some pretty weird ones. I think python's model is "Whatever your other tools use. Ask them." And I think that is a reasonable choice. For sensible input, the various models all work the same. For dubio

Re: [Python-Dev] Floor division

2007-01-23 Thread Anders J. Munch
[Tim Peters] > [Anders J. Munch] > > I did read the whole thread, and I saw your -1%1e100 example. Mixing > > floating-point numbers of very different magnitude can get you in > > trouble - e.g. -1+1e100==1e100. I don't think -1%1e100 is all that > > worse. > > Except that it's very easy to retu

Re: [Python-Dev] Floor division

2007-01-23 Thread Armin Rigo
Hi Tim, On Sun, Jan 21, 2007 at 09:08:18PM -0500, Tim Peters wrote: > >BTW - isn't that case in contradiction with the general Python rule that > >if b > 0, then a % b should return a number between 0 included and b > >excluded? > > Sure. You're not addressing my point, though, so I was probably

[Python-Dev] Object creation hook

2007-01-23 Thread Kristján V. Jónsson
Hello there. I am trying to insert a hook into python enabling a callback for all just-created objects. The intention is to debug and find memory leaks, e.g. by having the hook function insert the object into a WeakKeyDictionary. I have already added a method to "object" to set such a hook, and

Re: [Python-Dev] Fwd: Re: Floor division

2007-01-23 Thread Tim Peters
... [Facundo] >> We'll have to deprecate that functionality, with proper warnings (take >> not I'm not following the thread that discuss the migration path to 3k). >> >> And we'll have to add the method "remainder" to decimal objects (right >> now we have only "remainder_near" in decimal objects,

[Python-Dev] Fwd: Re: Floor division

2007-01-23 Thread python
>> Do note that this discussion is only about Python 3. Under the view >> that it was a (minor, but real) design error to /try/ extending >> Python's integer mod definition to floats, if __mod__, and __divmod__ >> and __floordiv__ go away for binary floats in P3K they should >> certainly go away

Re: [Python-Dev] Floor division

2007-01-23 Thread Facundo Batista
Tim Peters wrote: > Which "Spec"? For example, floor division isn't mentioned at all in > IBM's proposed decimal standard, or in PEP 327, or in the Python Oops, you're right. My fault, sorry. > Library Reference section on `decimal`. It's an artifact of trying to > extend Python's integer mod

Re: [Python-Dev] Floor division

2007-01-23 Thread Anthony Baxter
On Tuesday 23 January 2007 22:27, Tim Peters wrote: > Which is why I don't want binary or decimal floats to support > infix "%" as a spelling in P3K. I don't believe floating mod is > heavily used, and if so there's scant need for a one-character > spelling -- and if there's a method or function n

Re: [Python-Dev] Floor division

2007-01-23 Thread Nick Maclaren
A generic comment. Many of my postings seem to be being misunderstood. I hold no brief for ANY particular floating-point religion, sect or heresy, except insofar as it affects robustness and portability (i.e. "software engineering"). I can work with and teach almost any model, and have done so w

Re: [Python-Dev] [Python-checkins] buildbot failure in amd64 gentoo 2.5

2007-01-23 Thread Nick Coghlan
Michael Hudson wrote: > Giovanni Bajo <[EMAIL PROTECTED]> writes: > >> On 23/01/2007 10.20, Brian Warner wrote: >> > Do I miss something here, or is the buildbot hit by spammers now? It looks like it is. If that continues, we have to disable the web triggers. >>> Good grief. If anyon

Re: [Python-Dev] Floor division

2007-01-23 Thread Tim Peters
[Tim Peters] >> Please read the whole thread. Maybe you did, but you said nothing >> here that indicated you had. The issues aren't about tiny integers >> that happen to be in float format, where the result is exactly >> representable as a float too. Those don't create problems for any >> defini

Re: [Python-Dev] Floor division

2007-01-23 Thread Anders J. Munch
Tim Peters wrote: > Please read the whole thread. Maybe you did, but you said nothing > here that indicated you had. The issues aren't about tiny integers > that happen to be in float format, where the result is exactly > representable as a float too. Those don't create problems for any > defini

Re: [Python-Dev] Floor division

2007-01-23 Thread Tim Peters
[Guido] >>> I guess the conjugate() function could also just return self (although I see >>> that conjugate() for a complex with a zero imaginary part returns >>> something whose imaginary part is -0; is that intentional? [TIm Peters] >> That's wrong, if true: it should return something with the

Re: [Python-Dev] [Python-checkins] buildbot failure in amd64 gentoo 2.5

2007-01-23 Thread skip
Brian> Good grief. If anyone has any bright ideas about simple ways to Brian> change that form to make it less vulnerable to the spambots, I'd Brian> be happy to incorporate them into Buildbot. Require a password? It can be widely known throughout each buildbot community with little

Re: [Python-Dev] Floor division

2007-01-23 Thread skip
Tim> For example, floor division isn't mentioned at all in IBM's Tim> proposed decimal standard, or in PEP 327, or in the Python Library Tim> Reference section on `decimal`. It's an artifact of trying to Tim> extend Python's integer mod definition to floats, and for reasons Ti

Re: [Python-Dev] [Python-checkins] buildbot failure in amd64 gentoo 2.5

2007-01-23 Thread Michael Hudson
Giovanni Bajo <[EMAIL PROTECTED]> writes: > On 23/01/2007 10.20, Brian Warner wrote: > Do I miss something here, or is the buildbot hit by spammers now? >>> It looks like it is. If that continues, we have to disable the web >>> triggers. >> >> Good grief. If anyone has any bright ideas about

Re: [Python-Dev] Floor division

2007-01-23 Thread Tim Peters
[Anders J. Munch] > What design error? float.__mod__ works perfectly. > > >>> -1 % 50 > 49 > >>> -1.0 % 50.0 > 49.0 > >>> Please read the whole thread. Maybe you did, but you said nothing here that indicated you had. The issues aren't about tiny integers that happen to be in float format, where

Re: [Python-Dev] Floor division

2007-01-23 Thread Nick Maclaren
"Tim Peters" <[EMAIL PROTECTED]> wrote: > > > I guess the conjugate() function could also just return self (although I see > > that conjugate() for a complex with a zero imaginary part returns > > something whose imaginary part is -0; is that intentional? > > That's wrong, if true: it should retu

Re: [Python-Dev] [Python-checkins] buildbot failure in amd64 gentoo 2.5

2007-01-23 Thread Giovanni Bajo
On 23/01/2007 10.20, Brian Warner wrote: >>> Do I miss something here, or is the buildbot hit by spammers now? >> It looks like it is. If that continues, we have to disable the web >> triggers. > > Good grief. If anyone has any bright ideas about simple ways to change that > form to make it less

Re: [Python-Dev] Floor division

2007-01-23 Thread Anders J. Munch
Tim Peters wrote: > Do note that this discussion is only about Python 3. Under the view > that it was a (minor, but real) design error to /try/ extending > Python's integer mod definition to floats, if __mod__, and __divmod__ > and __floordiv__ go away for binary floats in P3K they should > certai

Re: [Python-Dev] [Python-checkins] buildbot failure in amd64 gentoo 2.5

2007-01-23 Thread Brian Warner
>> Do I miss something here, or is the buildbot hit by spammers now? > > It looks like it is. If that continues, we have to disable the web > triggers. Good grief. If anyone has any bright ideas about simple ways to change that form to make it less vulnerable to the spambots, I'd be happy to incor