Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Do you mean comparison with None?

  Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
  [GCC 5.4.0 20160609] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> 1 + None
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
  >>> 1 < None
  False
vs

  Python 3.5.2 (default, Nov 23 2017, 16:37:01)
  [GCC 5.4.0 20160609] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> 1 + None
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
  >>> 1 < None
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: unorderable types: int() < NoneType()


doh, you're absolutely right, cheers! edited the parent for posterity, too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: