Opened 3 years ago

Closed 5 months ago

#22390 closed enhancement (fixed)

Support for unary plus in sage_input expressions

Reported by: mkoeppe Owned by:
Priority: major Milestone: sage-9.1
Component: symbolics Keywords:
Cc: vdelecroix, vbraun, tscrim Merged in:
Authors: Matthias Koeppe Reviewers: Vincent Delecroix
Report Upstream: N/A Work issues:
Branch: fcbc478 (Commits) Commit: fcbc4789c76b7e4abace550ff4890595809e5272
Dependencies: Stopgaps:

Description (last modified by mkoeppe)

This ticket adds support for unary plus in sage_input expressions.

Change History (20)

comment:1 Changed 3 years ago by mkoeppe

  • Branch set to u/mkoeppe/support_for_unary_plus_in_sage_input_expressions

comment:2 Changed 3 years ago by mkoeppe

  • Authors set to Matthias Koeppe
  • Cc vdelecroix added
  • Commit set to 94366b0b3fe02bc42ef1e188653b1cc850ac0a67
  • Description modified (diff)
  • Status changed from new to needs_review

New commits:

94366b0Support unary plus in sage_input expressions

comment:3 Changed 3 years ago by mkoeppe

  • Cc vbraun added

comment:4 Changed 23 months ago by mkoeppe

  • Cc tscrim added
  • Milestone changed from sage-7.6 to sage-8.4

comment:5 follow-up: Changed 6 months ago by vdelecroix

+        elif op == '+':
+            prec = _prec_negate

Shouldn't there be instead a

_prec_negate = 28
+_prec_positive = 29
_prec_bitnot = 30

(BTW the section 5.14 of the Python reference manual is now 6.16 "Operator precedence")

comment:6 Changed 6 months ago by vdelecroix

  • Milestone changed from sage-8.4 to sage-9.1
  • Status changed from needs_review to needs_info

comment:7 Changed 6 months ago by tscrim

Sorry, I lost track of this ticket. Also, minor point but since this is considered formal writing don't -> do not, and also unary +.:: -> unary +:: as the .:: will become .: in the compiled documentation. If you really want the period, then use unary +. :: will get rid of the colon in the compiled doc.

comment:8 Changed 6 months ago by git

  • Commit changed from 94366b0b3fe02bc42ef1e188653b1cc850ac0a67 to 8c6012dc067ce0c92cd271757be79ff6b5bd44cc

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

8c6012dSupport unary plus in sage_input expressions

comment:9 Changed 6 months ago by git

  • Commit changed from 8c6012dc067ce0c92cd271757be79ff6b5bd44cc to 64e741d7e9f7974d45ba16c7fc232c4a34b5ccd4

Branch pushed to git repo; I updated commit sha1. New commits:

64e741dUpdate reference to the Python reference manual

comment:10 in reply to: ↑ 5 Changed 6 months ago by mkoeppe

Replying to vdelecroix:

+        elif op == '+':
+            prec = _prec_negate

Shouldn't there be instead a

_prec_negate = 28
+_prec_positive = 29
_prec_bitnot = 30

No, both in Python 2 and Python 3 unary + and - have the same precedence. (Also ~ (bitnot) has the same precedence as these two, but I consider it outside the scope of this ticket to fix this.)

comment:11 Changed 6 months ago by git

  • Commit changed from 64e741d7e9f7974d45ba16c7fc232c4a34b5ccd4 to fcbc4789c76b7e4abace550ff4890595809e5272

Branch pushed to git repo; I updated commit sha1. New commits:

fcbc478Docstring fix

comment:12 Changed 6 months ago by mkoeppe

  • Status changed from needs_info to needs_review

comment:13 Changed 5 months ago by mkoeppe

Ready for review

comment:14 Changed 5 months ago by mkoeppe

Is there still an interest in this ticket?

comment:15 Changed 5 months ago by vdelecroix

Sure, but I am confused about the priorities.

comment:16 Changed 5 months ago by vdelecroix

(I meant operator precedence)

comment:17 Changed 5 months ago by vdelecroix

  • Reviewers set to Vincent Delecroix

comment:18 Changed 5 months ago by vdelecroix

  • Status changed from needs_review to positive_review

comment:19 Changed 5 months ago by mkoeppe

Thank you!

comment:20 Changed 5 months ago by vbraun

  • Branch changed from u/mkoeppe/support_for_unary_plus_in_sage_input_expressions to fcbc4789c76b7e4abace550ff4890595809e5272
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.