[Kirill Balunov <kirillbalu...@gmail.com>]
> I apologize that I get into the discussion. Obviously in some situations it
> will be useful to check that a floating-point number is integral, but from
> the examples given it is clear that they are very rare. Why the variant with
> the inclusion of this functionality into the math module was not considered
> at all.

Nobody here really discussed the history, and I don't know.  The
questions here have been about what to do given that `is_integer` and
`as_integer_ratio` are _already_ advertised (public) methods on some
numeric types.


> If the answer is - consistency upon the numeric tower - will it go
> for complex type and what will it mean (there can be two point of views)?

I haven't seen anyone suggest either method be added to Complex.
There are lots of methods that don't show up in the tower before
hitting Real.  For example, given that Complex doesn't support
__float__, it would be bizarre if it _did_ support as_integer_ratio.


> Is this functionality so often used and practical to be a method of float,
> int, ..., and not just to be an auxiliary function?
>
> p.s.: The same thoughts about `as_integer_ratio` discussion.

I would have added them as functions in the `math` module instead.
perhaps supported by dunder methods (__as_integer_ratio__,
__is_integer__).  But that's not what happened, and whether or not
they have double underscores on each end doesn't really make all that
much difference except to dedicated pedants ;-)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to