Re:The Day Python Embarassed Imperative Programming
by whateverer on Monday February 27, 2012 @10:47AM
(#3639331)
Yes, actually, you are right. It's all the same in Python because the references can always point to any value, and None is just a value of the NoneType.
And due to Python's runtime types, it wouldn't matter either way, because even if None only existed within the context of a Maybe type, you could still just apply any operation on it and have crash at the first method call on it.
Re:The Day Python Embarassed Imperative Programming
by SoftwareMaven on Monday February 27, 2012 @10:42AM
(#3639310)
That's not completely accurate. None is still special in Python because it's the value chosen by the interpreter to represent an expression that doesn't explicitly return a value.
It is true that None is implemented like any other object (whther the value of 5 or an instance of my own class), but it still maintains special semantics.
In languages like Java, null has special semantics that no other value has. In Python, there's nothing particularly special about None, it's simply used as a convenient sentinel by convention. I could easily write Python code that returns the literal string "This value is empty" as the sentinel instead, something that doesn't apply to languages like Java.