logoalt Hacker News

IgorPartolatoday at 12:10 AM2 repliesview on HN

Is None OK in Python?

NULL in C just doesn’t belong at the end of a string. But IMO having a “there is no value here” designation is not a bad thing.


Replies

none_to_remaintoday at 12:24 AM

I think you're mixing up the NULL pointer and the NULL (sometimes NUL) character.

jibaltoday at 2:40 AM

Python is interpreted so None is always tested for and will throw an exception if used in the wrong context. This is quite different from a SEGVIO.

> But IMO having a “there is no value here” designation is not a bad thing.

Sure ... if it's done via the type system so that errors are caught at compile time. There's a reason that modern languages all either do this or are moving towards doing it. (And a reason that C programmers have no idea what we're talking about when we refer to type systems.)

> NULL in C just doesn’t belong at the end of a string.

Different discussion. (And NUL, not NULL.)