Message409101
Now that we have a shiny new parser, can we finally get rid of this language wart:
assert thing, description # works as intended
assert (thing, description) # always True as non-empty tuples are Truthy
This most often happens when extending thing or description beyond a single line on assert statements as () are the natural way to do that and as it is with assert being a statement, knowing specifically where to place the ()s to not fall into the pit of snakes of unintentionally nerfing your assertion to be an always true tuple is hard for human authors.
This would obsolete the pylint error about tuple assertion and enable more natural assert use.
py.test framework users would presumably rejoice as well.
This parsing change would need a PEP. I fail to see any obvious downsides though. |
|
Date |
User |
Action |
Args |
2021-12-23 19:58:53 | gregory.p.smith | set | recipients:
+ gregory.p.smith, lys.nikolaou, pablogsal |
2021-12-23 19:58:53 | gregory.p.smith | set | messageid: <1640289533.73.0.869146772295.issue46167@roundup.psfhosted.org> |
2021-12-23 19:58:53 | gregory.p.smith | link | issue46167 messages |
2021-12-23 19:58:53 | gregory.p.smith | create | |
|