- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
➜
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.
| Author | Mark.Shannon |
|---|---|
| Recipients | Mark.Shannon, Mohamed_Atef, ethan.furman, gregory.p.smith, gvanrossum, pablogsal, serhiy.storchaka, stestagg |
| Date | 2021-01-12.16:36:23 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1610469383.24.0.886633417817.issue42899@roundup.psfhosted.org> |
| In-reply-to |
| Content |
|---|
It's clearer if you rewrite
if a and b:
...
as
tmp = a and b
if tmp:
...
if a is falsey then bool(a) gets called in `tmp = a and b` and `a` is assigned to `tmp`. Then in `if tmp`, bool(a) is called again.
I agree with you about it not being an optimization if it changes the semantics. But only within agreed semantics.
Optimizations are allow to make fewer calls to __hash__() in a dictionary, or change race conditions, because those are outside of the language specification. |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2021-01-12 16:36:23 | Mark.Shannon | set | recipients: + Mark.Shannon, gvanrossum, gregory.p.smith, ethan.furman, serhiy.storchaka, Mohamed_Atef, pablogsal, stestagg |
| 2021-01-12 16:36:23 | Mark.Shannon | set | messageid: <1610469383.24.0.886633417817.issue42899@roundup.psfhosted.org> |
| 2021-01-12 16:36:23 | Mark.Shannon | link | issue42899 messages |
| 2021-01-12 16:36:23 | Mark.Shannon | create |
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements
