29.11.17 14:39, Nick Coghlan пише:
     "a if def else b" -> pronounced "a if defined, else b"

I understand "a if defined, else b" as

    try:
        result = a
    except (NameError, AttributeError, LookupError):
        result = b

The problem is that None is not undefined. This is a regular value. Seems it is not so special in Python as NULL or undef in other languages. Python even don't have a special purposed NullPointerException (or NoneError).

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to