-
-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let Sage honour PEP 515 (py3) #28490
Comments
Changed keywords from none to preparser |
This comment has been minimized.
This comment has been minimized.
Branch: u/jhpalmieri/preparse_underscore |
Commit: |
Author: John Palmieri |
comment:3
Here is an attempt. This does at least one other thing: it no longer allows leading zeroes in integers. This is not valid Python syntax, so Sage should not allow it, either. |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:5
In my understanding of the PEP (confirmed by testing on a ipython3 console), trailing underscores are not allowed, however we currently have:
Also, perhaps could you show the feature in action with a concrete example, something like:
|
Reviewer: Thierry Monteil |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:8
Okay, trailing underscores now should fail, and I added the doctest. |
This comment has been minimized.
This comment has been minimized.
comment:9
The patchbots seem unhappy, apparently the doctests do not behave the same there. |
comment:10
The doctests pass with Python 3, not with Python 2. I guess there is a question: using underscores is only valid starting in Python. Do we want to allow this in Sage built with Python 2? Also, a leading zero is valid in Python 2 but not in Python 3. What should we do about that? |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:12
I propose to allow underscores with Python 2. |
comment:31
Replying to @jhpalmieri:
Nice! To my mind, this is the end.
It is not the job of the preparser to modify the input string.
Which is precisely what I don't wnat to do here! |
comment:32
Replying to @videlec:
Why not? This is in the |
comment:33
Replying to @jhpalmieri:
Oups. I misread. It is fine modifying |
comment:34
Your 'fix' from the first part of comment:29 was not one... I will update the branch in a second. |
Changed branch from u/jhpalmieri/preparse_underscore to public/28490 |
New commits:
|
Changed author from John Palmieri to John Palmieri, Vincent Delecroix |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:39
With your branch in Python 2, |
This comment has been minimized.
This comment has been minimized.
comment:42
Replying to @jhpalmieri:
It is not nice I agree. But I do not quite see inconsistency. Some constructors (like Related comment: it would be interesting to benchmark the two options for the preparser |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:44
Okay, good enough, I think. |
Changed reviewer from Thierry Monteil to Thierry Monteil, Vincent Delecroix, John Palmieri |
Changed author from John Palmieri, Vincent Delecroix to Vincent Delecroix, John Palmieri |
Changed branch from public/28490 to |
PEP 515 numerical separators (such as 1_000_000, as introduced in sagemath#28490) behave inconsistently, ignoring everything after the first separator upon conversion to a different precision. Reproduction: {{{ sage: z = 1_0000.000000000000000000000000000000000000 sage: z # works as expected without the conversion 10000.000000000000000000000000000000000000 sage: RR(z) 1.00000000000000 }}} SageMath version 9.5, Release Date: 2022-01-30, Using Python 3.10.6, OS: Ubuntu 22.04.1 Also reproduces on Sage 9.7 URL: https://trac.sagemath.org/34819 Reported by: gh-io4 Ticket author(s): Lucas Fiegl Reviewer(s): Marc Mezzarobba
In Python 3, underscored numbers like
10_000_000.0
are allowed, but the preparser, as well as integer and real number constructors, do not handle them yet, see this Ask Sage question and PEP 515.CC: @slel
Component: python3
Keywords: preparser
Author: Vincent Delecroix, John Palmieri
Branch/Commit:
4c0787d
Reviewer: Thierry Monteil, Vincent Delecroix, John Palmieri
Issue created by migration from https://trac.sagemath.org/ticket/28490
The text was updated successfully, but these errors were encountered: