3 ms·
If you've never seen this message, you haven't been programming in Python for very long: AttributeError: 'NoneType' object has no attribute 'foo' Not to m
by kragen 7y ago
If you've never seen this message, you haven't been programming in Python for very long:
AttributeError: 'NoneType' object has no attribute 'foo'
Not to mention UnboundLocalError and cases of AttributeError that stem from trying to use attributes before they've been initialized. Some of these have slightly better ergonomics than Java’s pernicious null initialization, for example by crashing your program earlier, but the upshot is that everything you do in Java that will crash with a NullPointerException will also still crash your program in Python.
Oh, I guess except for shadowing an outer-scope variable with a local that you never initialize. That just gives you the wrong answer in Python, because there exists no local without an initialization. But it's a pretty marginal case.