Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-27 Thread Robert Smallshire
In the PR I've submitted, that's essentially what I'm doing for the default Real.is_integer() implementation. The details differ slightly, in that I rely on the int() constructor to call __trunc__(), rather than introduce a new dependency on the math module. On Tue, 27 Mar 2018 at 21:29, Chris Bar

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-27 Thread Chris Barker
I know this is all done, but for completeness’ sake: I just noticed math.trunc() and __trunc__(). So wouldn’t the “correct” way to check for an integral value be something like: obj.__trunc__() == obj I don’t think this has any bearing on adding is_integer() methods to numeric objects, but migh

Re: [Python-Dev] descriptor __set_name__ and dataclasses

2018-03-27 Thread Nick Coghlan
On 27 March 2018 at 01:17, Eric V. Smith wrote: > On 3/26/18 11:10 AM, Eric V. Smith wrote: >> >> On 3/26/18 11:08 AM, Nick Coghlan wrote: >>> >>> On 27 March 2018 at 00:40, Eric V. Smith wrote: > > >>> Would it be feasible to define `Field.__set_name__`, and have that >>> call `default.__set_nam