[Python-ideas] Python docs page: In what ways is None special

Brice Parent contact at brice.xyz
Tue Aug 14 12:55:32 EDT 2018


Nice work, very usefull.

Is it interesting enough to note that the negation of None is True? 
(probably just because when it's casted to bool, it becomes False).

Also,  even if None is seen as the value for the lack of value, it is 
still hashable and can be used as a key to a dict (I'm not saying it's 
always good practice!):

 >>> def f():
...     pass
...
 >>> {None: 5, not None: 6}
{None: 5, True: 6}
 >>> {f(): 4}
{None: 4}

Also, I would probably have added an example of how (and why) to use a 
sentinel value for when None has a meaning other than [not provided] in 
a function's signature.


You'll see if any of these is worth integrating.

- Brice


Le 14/08/2018 à 12:28, Jonathan Fine a écrit :
> Hi
>
> I'm pleased to announce that I've completed the first draft of my
> page. It's viewable on gitub.
> https://github.com/jfine2358/py-jfine2358/blob/master/docs/none-is-special.md
>
> To quote from that page:
>
> This page arose from a thread on the python-ideas list. I thank Steve
> Dower, Paul Moore, Steve D'Aprano, Chris Barker, David Mertz, Jörn
> Heissler, Anthony Risinger, Michael Selik, Chris Angelico for their
> contributions and encouragement.
>
> Apologies for anyone I've missed. Comments either on python-ideas, or
> perhaps better, by raising an issue on github.
>



More information about the Python-ideas mailing list