This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add binary operator!
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.10
process
Status: closed Resolution: postponed
Dependencies: Superseder:
Assigned To: Nosy List: hadialqattan, pablogsal
Priority: normal Keywords:

Created on 2020-10-04 21:22 by hadialqattan, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg377976 - (view) Author: Hadi Alqattan (hadialqattan) Date: 2020-10-04 21:22
What are your opinions about adding a binary operator to Python in order to make this code possible?
```
my_counter = 0

for i in rage(1000):
    my_counter += 1 if (i % 2) == 0
```
msg377985 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-10-04 23:41
You can already do:

my_counter = 0

for i in rage(1000):
    my_counter += (1 if (i % 2) == 0 else 0)
msg377986 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-10-04 23:42
In any case, for modifications about the Python syntax, please, open first some debate in the python-ideas mailing list.
History
Date User Action Args
2022-04-11 14:59:36adminsetgithub: 86101
2020-10-04 23:42:02pablogsalsetstatus: open -> closed
resolution: postponed
messages: + msg377986

stage: resolved
2020-10-04 23:41:08pablogsalsetnosy: + pablogsal
messages: + msg377985
2020-10-04 21:22:09hadialqattancreate