Opened 2 years ago
Closed 16 months ago
#30477 closed defect (fixed)
preparser: implicit multiplication conflicts with Python's complex literals
Reported by:  ghmwageringel  Owned by:  

Priority:  minor  Milestone:  sage9.5 
Component:  misc  Keywords:  preparser 
Cc:  Merged in:  
Authors:  Markus Wageringel  Reviewers:  Marc Mezzarobba 
Report Upstream:  N/A  Work issues:  
Branch:  1a171d2 (Commits, GitHub, GitLab)  Commit:  1a171d26e83b9c00e9b6f9429db1b4a8c0d578dc 
Dependencies:  Stopgaps: 
Description (last modified by )
When implicit multiplication is enabled, using complex literals does not work.
sage: implicit_multiplication(True) sage: preparse('1jr'), preparse('1rj') ('Integer(1)*jr', 'Integer(1)*rj')
Instead, it should behave like when implicit multiplication is disabled.
sage: implicit_multiplication(False) sage: preparse('1jr'), preparse('1rj') ('1J', '1J')
Change History (10)
comment:1 Changed 2 years ago by
Milestone:  sage9.2 → sageduplicate/invalid/wontfix 

Status:  new → needs_review 
comment:2 Changed 2 years ago by
Description:  modified (diff) 

Priority:  major → minor 
Summary:  preparsing Python's complex literals is broken in the REPL → preparser: implicit multiplication conflicts with Python's complex literals 
Oh, it turns out this is a conflict with implicit multiplication, which I had enabled in my init.sage file. Both 1rj
and 1jr
work when implicit multiplication is disabled. I have updated the description.
comment:3 Changed 2 years ago by
Status:  needs_review → needs_info 

Should we make 1jr
the only valid form?
comment:5 Changed 2 years ago by
Authors:  → Markus Wageringel 

Branch:  → u/ghmwageringel/30477 
Commit:  → 1a171d26e83b9c00e9b6f9429db1b4a8c0d578dc 
Milestone:  sageduplicate/invalid/wontfix → sage9.3 
Status:  needs_info → needs_review 
Here is a minimal fix. I have also changed the regular expressions to be caseinsensitive, which solves the following problem with scientific notation and implicit multiplication:
sage: implicit_multiplication(True) sage: 1e3 1000.00000000000 sage: 1E3 ... NameError: name 'E3' is not defined
New commits:
1a171d2  30477: fix conflict between implicit multiplication and complex literals

comment:6 Changed 23 months ago by
Milestone:  sage9.3 → sage9.4 

Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date.
comment:7 Changed 19 months ago by
Milestone:  sage9.4 → sage9.5 

Setting a new milestone for this ticket based on a cursory review.
comment:9 Changed 17 months ago by
Status:  needs_review → positive_review 

comment:10 Changed 16 months ago by
Branch:  u/ghmwageringel/30477 → 1a171d26e83b9c00e9b6f9429db1b4a8c0d578dc 

Resolution:  → fixed 
Status:  positive_review → closed 
To signal a complex literal as raw, place the
r
at the very end:I suggest to close as invalid or wontfix.
But I will listen to arguments for doing otherwise.