Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Dave Angel
On 01/06/2015 10:37 PM, Andrew Robinson wrote: On 01/06/2015 06:31 PM, Chris Angelico wrote: I already KNOW that 'C++' does have a workaround mechanism, as I've mentioned in a different e-mail, so that there's no reason to instantiate an instance of the subclass of a singleton if you don't w

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Chris Angelico
On Wed, Jan 7, 2015 at 2:39 PM, Dave Angel wrote: > Here we need help from someone who knows more about this particular detail. > I don't know which special methods bool() or not will call, but I'd think it > would be something with a better name than __nonzero__ In Python 2, it is indeed __nonze

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Dave Angel
On 01/06/2015 09:01 PM, Andrew Robinson wrote: On 01/06/2015 06:02 AM, Dave Angel wrote: On 01/06/2015 08:30 AM, Andrew Robinson wrote: So, I'm not sure I can subclass boolean either because that too is a built in class ... but I'm not sure how else to make an object that acts as boolean Fa

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
On 01/06/2015 06:31 PM, Chris Angelico wrote: The type check issue is mostly about compatability in the first place ; eg: users typecheck either unintentionally -- (novices syndrome) -- or because they need all the capabilities of a given type, and the only simple way to find out if they are a

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
On 01/06/2015 06:34 PM, Terry Reedy wrote: On 1/6/2015 9:01 PM, Andrew Robinson wrote: [snip] There are very few (about 4) builtin classes that cannot be subclassed. bool is one of those few, float is not. Go ahead and subclass it. >>> class F(float): pass >>> F >>> F(2.3) + F(3.3) 5.6

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Terry Reedy
On 1/6/2015 9:01 PM, Andrew Robinson wrote: [snip] There are very few (about 4) builtin classes that cannot be subclassed. bool is one of those few, float is not. Go ahead and subclass it. >>> class F(float): pass >>> F >>> F(2.3) + F(3.3) 5.6 -- Terry Jan Reedy -- https://mail.python.

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Chris Angelico
On Wed, Jan 7, 2015 at 1:20 PM, Andrew Robinson wrote: > Because defining a bunch of special methods defeats the very purpose of > making my class compatible with float variables. > eg: No legacy code would work... > > I know (belatedly) that am going to have to define my own class. > That's prett

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
On 01/06/2015 05:35 AM, Chris Angelico wrote: On Wed, Jan 7, 2015 at 12:30 AM, Andrew Robinson wrote: Why this is so important to Guido, I don't know ... but it's making it VERY difficult to add named aliases of False which will still be detected as False and type-checkable as a bool. If my o

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
On 01/06/2015 06:02 AM, Dave Angel wrote: On 01/06/2015 08:30 AM, Andrew Robinson wrote: So, I'm not sure I can subclass boolean either because that too is a built in class ... but I'm not sure how else to make an object that acts as boolean False, but can be differentiated from false by the

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Steven D'Aprano
Andrew Robinson wrote: > Hi, > I'm building a custom numeric class that works with values that have > uncertainty and am wanting to make it as compatible with floating point > objects as possible -- so as to be usable in legacy code with minimal > rewites; but but I am having trouble understanding

ANN: psutil 2.2.0 released

2015-01-06 Thread Giampaolo Rodola'
Hello all, I'm glad to announce the release of psutil 2.2.0. In this new release I decided to drop support for Python 2.4 and 2.5 for good. Whoever is still on Python 2.4 and 2.5 can use old 2.1.3 version: https://pypi.python.org/pypi?name=psutil&version=2.1.3&:action=files Main features and bugfi

SQLObject 2.1.0

2015-01-06 Thread Oleg Broytman
Hello! I'm pleased to announce version 2.1.0, the first stable release of branch 2.1 of SQLObject. What's new in SQLObject === Minor features -- * In queries generated with SQLObject's tables columns are sorted in the order they are declared in the table. * I

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Dave Angel
On 01/06/2015 08:30 AM, Andrew Robinson wrote: So, I'm not sure I can subclass boolean either because that too is a built in class ... but I'm not sure how else to make an object that acts as boolean False, but can be differentiated from false by the 'is' operator. It's frustrating -- what go

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Chris Angelico
On Wed, Jan 7, 2015 at 12:30 AM, Andrew Robinson wrote: > Why this is so important to Guido, I don't know ... but it's making it VERY > difficult to add named aliases of False which will still be detected as > False and type-checkable as a bool. If my objects don't type check right -- > they will

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
So, I'm not sure I can subclass boolean either because that too is a built in class ... but I'm not sure how else to make an object that acts as boolean False, but can be differentiated from false by the 'is' operator. It's frustrating -- what good is subclassing, if one cant subclass all the

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Dave Angel
On 01/06/2015 05:27 AM, Andrew Robinson wrote: Hi, I'm building a custom numeric class that works with values that have uncertainty and am wanting to make it as compatible with floating point objects as possible -- so as to be usable in legacy code with minimal rewites; but but I am having troubl

Comparisons and sorting of a numeric class....

2015-01-06 Thread Andrew Robinson
Hi, I'm building a custom numeric class that works with values that have uncertainty and am wanting to make it as compatible with floating point objects as possible -- so as to be usable in legacy code with minimal rewites; but but I am having trouble understanding how to handle magnitude comp