Re: [sage-devel] Re: Registering NumberField as numbers.Number

2021-07-15 Thread TB
On 15/07/2021 22:11, William Stein wrote: On Thu, Jul 15, 2021 at 11:05 AM William Stein wrote: On Thu, Jul 15, 2021 at 9:13 AM Nils Bruin wrote: Following up: while sage's "RationalNumber" is indeed a numbers.Rational according to "isinstance", it does not actually adhere to the stated AP

Re: [sage-devel] Re: Registering NumberField as numbers.Number

2021-07-15 Thread William Stein
On Thu, Jul 15, 2021 at 11:05 AM William Stein wrote: > > On Thu, Jul 15, 2021 at 9:13 AM Nils Bruin wrote: > > > > Following up: while sage's "RationalNumber" is indeed a numbers.Rational > > according to "isinstance", it does not actually adhere to the stated API: > > "numerator" and "denomin

Re: [sage-devel] Re: Registering NumberField as numbers.Number

2021-07-15 Thread Vincent Delecroix
See https://trac.sagemath.org/ticket/28234 Le 15/07/2021 à 18:13, Nils Bruin a écrit : Following up: while sage's "RationalNumber" is indeed a numbers.Rational according to "isinstance", it does not actually adhere to the stated API: "numerator" and "denominator" are supposed to be properties, b

Re: [sage-devel] Re: Registering NumberField as numbers.Number

2021-07-15 Thread William Stein
On Thu, Jul 15, 2021 at 9:13 AM Nils Bruin wrote: > > Following up: while sage's "RationalNumber" is indeed a numbers.Rational > according to "isinstance", it does not actually adhere to the stated API: > "numerator" and "denominator" are supposed to be properties, but in sage they > are method

[sage-devel] Re: Registering NumberField as numbers.Number

2021-07-15 Thread Nils Bruin
Following up: while sage's "RationalNumber" is indeed a numbers.Rational according to "isinstance", it does not actually adhere to the stated API: "numerator" and "denominator" are supposed to be properties, but in sage they are methods. So even in places where we are trying to fit into "Number

[sage-devel] Re: Registering NumberField as numbers.Number

2021-07-15 Thread Nils Bruin
Taking a quick look at the relevant PEP https://www.python.org/dev/peps/pep-3141/ or the documentation https://docs.python.org/3/library/numbers.html#module-numbers (the PEP has considerably more detail), I get the impression that our Integer and Rational type could be incorporated in the hiera

Re: [sage-devel] Registering NumberField as numbers.Number

2021-07-15 Thread Vincent Delecroix
I don't think there is any deep reason. Sage started much before the existence of the numbers Python module. Note that the concept of "Number" is not clearly stated in the library. Does it include finite fields? padics? polynomials (these can be seen as infinitesimal deformation of scalars)? Vin

[sage-devel] Registering NumberField as numbers.Number

2021-07-15 Thread 'jonatha...@googlemail.com' via sage-devel
Hi, I was looking into typing a bit and realized that our number field elements are not registered as numbers. So the following will not evaluate to true: sage: import numbers sage: K. = QuadraticField(2) sage: isinstance(a, numbers.Number) Is there a reason, we do not register number fields in