Forbid chaining `is`
See original GitHub issueRule request
Thesis
Forbid ast.Is
in ast.Compare.ops
when it’s size is not zero. For example:
a = None
a is None # True, as expected
a is None is True # False 🤔
a is None == True # False 🤔
a is None is None # True 🤯
Reasoning
From the AST perspective, is
is an operator and can be chained. That can lead to unexpected results when the author wanted to compare the result of a is b
operation. Instead, Python will chain the operations and compare the last argument of the previous operation.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Chaining Is Prohibited in the Following Communities - PETA
This ordinance prohibits dogs from being chained to a fixed point. Under this ordinance, dogs are allowed to be confined by a trolley...
Read more >Table of State Dog Tether Laws
Tethering or chaining a dog simply means that a person ties a dog with a rope, ... California prohibits tethering a dog to...
Read more >The Dangers of Dog Chaining
“Dog chaining” describes a practice in which dog owners tether their dogs outdoors to a stationary object for extended periods of time.
Read more >Another state bans chaining dogs without 'adequate shelter'
The new law bans tethering dogs unless owners provide “adequate shelter,” a space that is comfortable for the dog to move around in, ......
Read more >New Texas law to ban chaining dogs | News | athensreview.com
This is great news for dogs seen dragging the neighborhood with a huge towing chain or a collar that digs into their skin....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sobolevn You know me, can’t stay away from a free T-shirt 😃
Hi, @lensvol! Happy to see you 😃