None versus MISSING sentinel -- request for design feedback

Ethan Furman ethan at stoneleaf.us
Sun Jul 17 02:31:06 CEST 2011


Gregory Ewing wrote:
> Ethan Furman wrote:
>> some of the return values (Logical, Date, DateTime, and probably 
>> Character) will have their own dedicated singletons (Null, NullDate, 
>> NullDateTime, NullChar -- which will all compare equal to None)
> 
> That doesn't seem like a good idea to me. It's common practice
> to use 'is' rather than '==' when comparing things to None.
> 
> Why do you want to use special null values for these types?

Okay, after spending some time thinking about this question
I don't believe I have a good answer.  I think it was probably something 
I thought of back when I started this project (which is basically what I 
learned Python on) and I've since learned enough that whatever reason I 
had back then has been replaced with more thorough knowledge and better 
practices.

The best reason I have at this point is being able to know what the Null 
value is supposed to represent -- True/False, a Date, etc. -- however, 
even that is weakened by my decision to use None for Null in the case of 
Character and Numerics; so there is probably no reason to not use None 
in the case of Logicals, Dates, DateTimes, and Times.

Thank you for the question!

~Ethan~



More information about the Python-list mailing list