Re: Question about None



On Jun 13, 1:49 pm, Paul Rubin <http://phr...@xxxxxxxxxxxxxx> wrote:
John Yeung <gallium.arsen...@xxxxxxxxx> writes:
Because you might want None to behave as though it were
nothing at all.

Sure, you might also want strings to behave as if they
were ints, but wishing doesn't make it so.

I'm not saying that the OP, as a programmer using Python, would wish
that Python's None behaves like nothing. I'm saying that as a
philosophical question, which is how he phrased it, one might want
one's language (perhaps one is designing this language) to have
something that behaves like "nothing", and then call this "None". I
don't think he's saying that the wrong choice was made for Python; I'm
certainly not saying that; it was just a musing.

But mathematically speaking, it's intuitive that
"nothing" would match any type.

Completely wrong.  The concept you're thinking of in
denotational semantics is called "bottom", but bottom
is not a value that functions can compute and return.
 It is really the absence of a value.

I've never heard a mathematician use the term "bottom". It certainly
could be that I just haven't talked to the right types of
mathematicians. I'm not sure it's even relevant. "Denotational
semantics" is specific to computer science. My point was simply that
even an elementary understanding of mathematics (and I'll grant a
naive understanding of computer science as well) might lead someone to
think that it *might* make sense for None to be the name for nothing.

I find that it's somewhat like the confusion that often
occurs regarding the all() function.

It's the other way though, all([])=True makes sense,
isinstance(None,int) does not.

Look, even a lot of the people on this very list, who answer questions
as if they are experts, have been tripped up by all(). I am not here
to say they are stupid. I also do not mean to present myself as an
expert, whether in math, computer science, or Python in particular.
I'm just trying to present the reasoning someone (however naive) might
have to even bring up the possibility that it might make sense for
isinstance(None, foo) to be True for any foo.

I probably would not have been prompted to respond in the first place
if Steven D'Aprano hadn't deemed the notion to require three
exclamation points to shoot down. I think it is enough to say that
None is an object and it has a specific type, thus it shouldn't match
any other type; which is what he then said, albeit excitedly. ;)

John
.



Relevant Pages

  • Re: Window.close and Explorer 7 problem!
    ... Are you saying that every page in the world should behave the way you think it should even though you are not part of the intended audience and nor will you even ever be in a position to view the page? ... popup blockers are considered good but when you get your 100th phone call in a week where a user can't access the e-learning course they are required to do because they don't realise that the popup blocker is preventing the LMS from launching the course then your opinion of popup blockers gets tempered a bit. ...
    (comp.lang.javascript)
  • Re: Beliefs?
    ... That is like saying that the basic point of Darwin's ... He doesn't say a thing about the ethical content of most religions. ... should behave towards others as we would wish them to behave towards ... Science is not a branch of ethics. ...
    (uk.religion.christian)
  • Re: Everyone please read
    ... What I find curious is that very few people behave ... unpleasant for the majority? ... Well since we are behind a computer we can get away with saying lot more. ... I wouldn't punch anyone who is a rude dickhead. ...
    (rec.pets.cats.anecdotes)
  • Re: Are there *any* honest car salesmen?
    ... Adrian wrote: ... they were saying: ... having issues - because it isn't, so doesn't behave like one. ... You can select any gear you like on that. ...
    (uk.rec.driving)
  • Re: Cindys request
    ... Ito wrote: ... Not a word I'd use as a gloss for 遠慮. ... visit, try and be nice for once!", but that saying be nice for the whole ... It would be "trying to behave nicely". ...
    (sci.lang.japan)