Changes between Version 1 and Version 2 of Ticket #18416, comment 3
- Timestamp:
- Mar 21, 2013, 11:44:38 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #18416, comment 3
v1 v2 13 13 It's the `value is None` that causes the problem. [http://stackoverflow.com/questions/15399024/does-the-is-operator-use-a-magic-method-in-python It's an identity test]. 14 14 15 If the intent of the if-test is to return `None` when the supplied value equates to `None`, then the if-test should be re-written as `value == None`, which would test for equality. The equality test is slower, though, so you'll likely find argument against using it in this section of the code. Oddly built objects with __eq__overloaded might also find trouble.15 If the intent of the if-test is to return `None` when the supplied value equates to `None`, then the if-test should be re-written as `value == None`, which would test for equality. The equality test is slower, though, so you'll likely find argument against using it in this section of the code. Oddly built objects with `__eq__` overloaded might also find trouble. 16 16 17 17 So there may not be much to do here, leaving the burden on the user to figure out what's going on. But I wanted to add some documentation to this bug for future reference.