#20062: Make _floordiv_() for power series a deprecated alias for _div_()
-------------------------------------+-------------------------------------
Reporter: pbruin | Owner:
Type: task | Status: needs_review
Priority: minor | Milestone: sage-7.1
Component: algebra | Resolution:
Keywords: | Merged in:
Authors: Peter Bruin | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/pbruin/20062-PowerSeries_floordiv| e9719f7399ffab100407a360c16fe0596e7f2689
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by bruno):
Replying to [comment:9 pbruin]:
> Replying to [comment:8 bruno]:
> > Note that there exists a method `quo_rem` for `DiscreteValuationRing`s
which works.
> Yes, I added that in #20283.
I did not notice that, so you probably knew this `:-)`.
> > Thus it should be possible to use it to get a method `__floordiv__`. I
am not sure to understand the subtleties described in comment:5 and
comment:6, but at least there is some working code. For instance:
> >
> > {{{#!python
> > sage: R.<x> = QQ[[]]
> > sage: R(1).quo_rem(1+t)
> > (1 - t + t^2 - t^3 + t^4 - t^5 + t^6 - t^7 + t^8 - t^9 + t^10 - t^11 +
t^12 - t^13 + t^14 - t^15 + t^16 - t^17 + t^18 - t^19 + O(t^20),
> > 0)
> > }}}
> Yes, absolutely. There are two problems: (1) due to the problem
mentioned in comment:5, it seems that we cannot easily implement a generic
`__floordiv__` using `quo_rem` for all Euclidean domains simultaneously,
and (2) in view of backward compatibility it would not be very good to
change the behaviour of `__floordiv__` without any warning or deprecation
of the old behaviour.
Again, I simply trust you for the technical part about `__floordiv__`. For
the deprecation policy, I (probably) agree that we should warn the user.
Isn't it possible to put a deprecation warning while changing the
behavior? I mean, one could do something like:
* If `self.quo_rem(other)` works, return `self.quo_rem(other)[0]`;
* Else return `self._div_(other)`;
* In all cases, print a deprecation message such as (message to be
improved for sure!): `The operator // now performs a euclidean division
(when possible) rather than a division. Use / instead to perform a
division.`
--
Ticket URL: <http://trac.sagemath.org/ticket/20062#comment:10>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.