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
compiler need support in(de)crement operation or all of it should have syntax error. #81485
Comments
compiler need support unary operation of in(de)crement or all of it should have syntax error.I have found many user have confused about it(such as:https://stackoverflow.com/questions/2632677/python-integer-incrementing-with). Of course, it is a big change of grammar and it need core developer team to make decision. If core developer team support it, i will try my best to do it;) The behavior is: $ ./python
Python 3.8.0a4+ (heads/master:e225beb, Jun 4 2019, 00:35:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> i = 1;
>>> ++i
1
>>> i++
File "<stdin>", line 1
i++
^
SyntaxError: invalid syntax |
For the reasons already discussed on the Stackoverflow link you gave, Python does not have pre- and post-increment and -decrement operators, and probably never will. I'm closing this ticket as Won't Fix, but if you wish to discuss it further, you can raise it on Python-Ideas for community feedback. If there is significant interest, you can then write a PEP for it, and if the PEP is approved, then you can re-open this ticket and provide a PR or patch. https://mail.python.org/mailman3/lists/python-ideas.python.org/ |
Thank for your suggestion,Steven. If python can not support post-increment and -decrement operators now, i think ++i should raise syntax error as i++. |
Since ++i already has a meaning, it won't become a syntax error without an extremely good reason, and I don't think this case meets that standard. But as Steven says, if you want to pursue it, you should start with a discussion on python-ideas. |
got it, Eric |
A discussion was initiated in https://discuss.python.org/t/why-compiler-doesnt-support-in-de-crement-operation-should-we-support-it/2181. And most of user tend not to support this in(de)crement operation. |
Please remember that not all Python programmers come from a C background Making As you were told (twice) last year, this change will not be considered If you get a consensus that the change is a good idea, you need to find |
Steven, Thank you for your quick comment. sure, i will keep this bpo stay in |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: