None versus MISSING sentinel -- request for design feedback

T

Terry Reedy

On 7/15/2011 6:19 AM, Steven D'Aprano wrote:

Use None as default. Requiring users to use your special value would be
a nuisance. They may have data prepared separately from your module.
Rob Williscroft wrote:

This is also a good idea.
So you think the right API is to allow the caller to specify what counts as
a missing value at runtime? Are you aware of any other statistics packages
that do that?

AFAIK, standard feature on major packages. BMDP, SAS and SPSS as I
remember. Missing values could be specified on a per column basis.
 
G

Gregory Ewing

Ethan said:
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?
 
E

Ethan Furman

Gregory said:
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~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top