Message349477
| Author |
rhettinger |
| Recipients |
mark.dickinson, rhettinger, tim.peters, tomerv |
| Date |
2019年08月12日.15:59:37 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1565625577.55.0.825866064001.issue37831@roundup.psfhosted.org> |
| In-reply-to |
| Content |
+0 This proposal may be worth re-considering. I've seen the problem arise in practice on multiple occasions. I suspect that it will continue to give people trouble.
Right now, a bool is-a int that 1) only has two singleton instances equal to zero and one, 2) has a different repr, and 3) has the & | and ^ operations redefined to return instances of bool.
I think we could also override the ~ operation. That would be a Liskov violation, making bools slightly less substitutable for ints, but it does so in a way that is intuitive and likely to match what a user intends when inverting a bool. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2019年08月12日 15:59:37 | rhettinger | set | recipients:
+ rhettinger, tim.peters, mark.dickinson, tomerv |
| 2019年08月12日 15:59:37 | rhettinger | set | messageid: <1565625577.55.0.825866064001.issue37831@roundup.psfhosted.org> |
| 2019年08月12日 15:59:37 | rhettinger | link | issue37831 messages |
| 2019年08月12日 15:59:37 | rhettinger | create |
|