Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#22774 closed defect (fixed)

Deprecation warning message should guide a user to import lcm from sage.arith.all.

Reported by: klee Owned by:
Priority: minor Milestone: sage-8.0
Component: basic arithmetic Keywords:
Cc: vdelecroix Merged in:
Authors: Jeroen Demeyer Reviewers: Kwankyu Lee, Vincent Delecroix
Report Upstream: N/A Work issues:
Branch: 9a762f0 (Commits, GitHub, GitLab) Commit:
Dependencies: Stopgaps:

Status badges

Description

As of Sage 8.0.beta, the location of lcm has changed from sage.arith.misc to sage.arith.functions, and the deprecation warning warns that lcm should be imported directly from sage.arith.functions. But the close friend gcd is still in sage.arith.misc and an ordinary user would expect gcd and lcm found in the same package.

From the user point of view, everything should be imported as

from sage.arith.all import gcd, lcm

and the warning message should guide a user to import lcm from sage.arith.all.

Change History (13)

comment:1 Changed 6 years ago by klee

Cc: vdelecroix added

comment:2 Changed 6 years ago by vdelecroix

I got the following deprecation warning

sage: from sage.rings.arith import gcd
sage: gcd(2,3)
...:2881: DeprecationWarning: 
Importing gcd from here is deprecated. If you need to use it,
please import it directly from sage.arith.all
See http://trac.sagemath.org/19879 for details.
  exec(code_obj, self.user_global_ns, self.user_ns)
1
sage: from sage.rings.arith import lcm
sage: lcm(2,3)
...:2881: DeprecationWarning: 
Importing lcm from here is deprecated. If you need to use it,
please import it directly from sage.arith.all
See http://trac.sagemath.org/19879 for details.
  exec(code_obj, self.user_global_ns, self.user_ns)
6

And sage.arith.functions is not mentioned.

Last edited 6 years ago by vdelecroix (previous) (diff)

comment:3 in reply to:  2 Changed 6 years ago by klee

Replying to vdelecroix:

I got the following deprecation warning

sage: from sage.rings.arith import gcd
sage: gcd(2,3)
...:2881: DeprecationWarning: 
Importing gcd from here is deprecated. If you need to use it,
please import it directly from sage.arith.all
See http://trac.sagemath.org/19879 for details.
  exec(code_obj, self.user_global_ns, self.user_ns)
1
sage: from sage.rings.arith import lcm
sage: lcm(2,3)
...:2881: DeprecationWarning: 
Importing lcm from here is deprecated. If you need to use it,
please import it directly from sage.arith.all
See http://trac.sagemath.org/19879 for details.
  exec(code_obj, self.user_global_ns, self.user_ns)
6

And sage.arith.functions is not mentioned.

I guess that is a different deprecation message. Try from sage.arith.misc import lcm. But you will still not see the warning message as this is already imported at startup. To see that, write a short script.

comment:4 Changed 6 years ago by klee

Branch: u/klee/22774
Commit: ba7e9cab3074ce1153236807f766900492cff005

New commits:

ba7e9caChange warning message

comment:5 Changed 6 years ago by klee

Status: newneeds_review

comment:6 Changed 6 years ago by jdemeyer

Branch: u/klee/22774u/jdemeyer/22774

comment:7 Changed 6 years ago by jdemeyer

Authors: Jeroen Demeyer
Commit: ba7e9cab3074ce1153236807f766900492cff0059a762f03b80c3de388740a5b5266f6d9af4f3c9a

I think this is a simpler solution.


New commits:

9a762f0Deprecation warning message should guide a user to import lcm from sage.arith.all

comment:8 Changed 6 years ago by vdelecroix

I am happy with it. Is it ok also for you Kwankyu?

comment:9 Changed 6 years ago by klee

I am happy too!

comment:10 Changed 6 years ago by jdemeyer

Reviewers: Kwankyu Lee
Status: needs_reviewpositive_review

comment:11 Changed 6 years ago by klee

Reviewers: Kwankyu LeeKwankyu Lee; Vincent Delecroix

comment:12 Changed 6 years ago by vbraun

Branch: u/jdemeyer/227749a762f03b80c3de388740a5b5266f6d9af4f3c9a
Resolution: fixed
Status: positive_reviewclosed

comment:13 Changed 5 years ago by jdemeyer

Commit: 9a762f03b80c3de388740a5b5266f6d9af4f3c9a
Reviewers: Kwankyu Lee; Vincent DelecroixKwankyu Lee, Vincent Delecroix
Note: See TracTickets for help on using tickets.