El jue, 21 oct 2021 a las 10:25, David Mertz, Ph.D. (<david.me...@gmail.com>)
escribió:

> I've moved this to python-ideas where it is more appropriate, as Chris
> notes
>
> On Thu, Oct 21, 2021, 8:42 PM Chris Angelico <ros...@gmail.com> wrote:
>
>> On Fri, Oct 22, 2021 at 3:23 AM David Mertz, Ph.D.
>> <david.me...@gmail.com> wrote:
>> >
>> > On Thu, Oct 21, 2021 at 2:52 AM Steven D'Aprano <st...@pearwood.info>
>> wrote:
>> >>
>> >> On Tue, Oct 19, 2021 at 05:09:42PM -0700, Michael Selik wrote:
>> >> > None and its ilk often conflate too many qualities. For example, is
>> it
>> >> > missing because it doesn't exist, it never existed, or because we
>> never
>> >> > received a value, despite knowing it must exist?
>> >
>> >
>> >>
>> >> 30+ years later, and we cannot easily, reliably or portably use NAN
>> >> payloads. Most people don't care. If we offerred them a dozen or a
>> >> thousand distinct sentinels for all the various kinds of missing data,
>> >> how many people would use them and how many would just stick to plain
>> >> old None?
>> >
>> >
>> > In data science, I have been frustrated by the sparsity of ways of
>> spelling "missing value."
>>
>> Might be worth redirecting this to -ideas.
>>
>> > Besides the distinction Michael points out, and that Steven did in
>> relation to NaNs with payloads, I encounter missingness of various other
>> sorts as well.  Crucially,  an important kind of missing data is data where
>> the value I received seems unreliable and I have decided to *impute*
>> missingness rather than accept a value I believe is unreliable.
>> >
>> > But there is also something akin to what Michael points out (maybe it's
>> just an example).  For example, "middle name" is something that some people
>> simply do not have, other people choose not to provide on a survey, and
>> others still we just don't know anything beyond "it's not there."
>> >
>>
> This feels like something you should express with an enum for all the
different kinds of missing data:

class MissingReason(enum.Enum):
    no_middle_name = 1
    not_provided = 2
    unknown = 3

middle_name: str | MissingReason

This gives you more structured and precise data than None-plus-string-tag
and avoids breaking the ecosystem by changing the meaning and behavior of
None.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EOBURF7EFGD5CLZS35GFTCWYZU2M7RDQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to