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

2018-08-16 Thread Jonathan Fine
Hi Paul We wrote >> I'd like to take this to bugs.python.org, if only to provide another >> route to discovering this (very useful) conversation. > > That's perfectly OK, and entirely your choice. However, if you do so, > I'd hope that you present the dissenting views from this list when you >

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

2018-08-16 Thread Paul Moore
On Thu, 16 Aug 2018 at 15:28, Jonathan Fine wrote: > I'd like to take this to bugs.python.org, if only to provide another > route to discovering this (very useful) conversation. That's perfectly OK, and entirely your choice. However, if you do so, I'd hope that you present the dissenting views

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

2018-08-16 Thread Rhodri James
On 16/08/18 14:41, Jonathan Fine wrote: Hi Rhodri Thank you for your message. You wrote: I disagree. That original text looks like it has been very carefully written to be (almost) true. What you are proposing to replace it with is less true and confusing to boot. The decision is neither

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

2018-08-16 Thread Jonathan Fine
Hi Paul Thank you for your comments. I think different people experience things in different ways, based on who they are. What their background, training, experience are. One person's precision is another's pedantry. An aside. Babbage and Tennyson: https://www.uh.edu/engines/epi879.htm You

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

2018-08-16 Thread Paul Moore
On Thu, 16 Aug 2018 at 14:26, Rhodri James wrote: > > On 16/08/18 14:04, Jonathan Fine wrote: > > And I think there's more. The page says > >> None > >> This type has a single value. There is a single object with this value. > >> [...] > > I think it better to write > >> NoneType > >> This type

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

2018-08-16 Thread Jonathan Fine
Hi Rhodri Thank you for your message. You wrote: > I disagree. That original text looks like it has been very carefully > written to be (almost) true. What you are proposing to replace it with is > less true and confusing to boot. The decision is neither your's nor mine. It is for the Python

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

2018-08-16 Thread Rhodri James
On 16/08/18 14:04, Jonathan Fine wrote: And I think there's more. The page says None This type has a single value. There is a single object with this value. [...] I think it better to write NoneType This type has a single value, `None`. The keyword `None` always gives the value `None`. I

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

2018-08-16 Thread Jonathan Fine
Hi Neil Thank you for your post, regarding https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy. You've suggested changing "built-in name None" to "keyword None". I think that's a good change. And similar changes might be welcome elsewhere in the docs, perhaps also for

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

2018-08-16 Thread Neil Girdhar
Is None a builtin? In [1]: from keyword import kwlist In [3]: 'Ellipsis' in kwlist Out[3]: False In [4]: 'None' in kwlist Out[4]: True Maybe we should change This type has a single value. There is a single object with this value. This object is accessed through the built-in name None. It is

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

2018-08-16 Thread Rhodri James
On 15/08/18 19:55, Jonathan Fine wrote: Rhodri says my version, exaggerated for effect, reads like Sometimes a value is required. But (pay careful attention to this, it's important and there will be a quiz later) we're not able to provide one. Yes, Rhodri, you've understood what I'm doing. I

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

2018-08-15 Thread Jonathan Fine
Hi Thank you all, for the kind words and appreciation, and the comments and suggestions. I have time now to respond to one comment. Please note that is just my opinion, and your opinion may be different. Rhodri James prefers

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

2018-08-15 Thread Chris Barker via Python-ideas
Since I already spent a bunch of time on this, I did a PR: https://github.com/jfine2358/py-jfine2358/pull/2 further discussion should probably be in that PR / repo -CHB On Wed, Aug 15, 2018 at 9:02 AM, Chris Barker - NOAA Federal < chris.bar...@noaa.gov> wrote: > > None is keyword, and just

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

2018-08-15 Thread Chris Barker - NOAA Federal via Python-ideas
> None is keyword, and just like any other keyword, it can't be re-bound. >> it's only a keyword because Python doesn't otherwise have a way of creating >> non-rebindable names. It's purpose is to represent the singular object of >> NoneType, and in that sense it's a literal as much as [] or

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

2018-08-15 Thread Rhodri James
On 15/08/18 00:09, Chris Barker wrote: On Tue, Aug 14, 2018 at 10:45 AM, Rhodri James wrote: On 'None is a constant': Erm. I think you've got carried away with simplifying this and gone down a blind alley. None is a literal, and like any other literal can't be rebound. no, it's not --

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

2018-08-14 Thread Chris Angelico
On Wed, Aug 15, 2018 at 9:09 AM, Chris Barker via Python-ideas wrote: > no, it's not -- None is keyword, and just like any other keyword, it can't > be re-bound. However, every other keyword I tried to rebind results in a > generic: > > SyntaxError: invalid syntax > > (except None, True, and

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

2018-08-14 Thread Chris Barker via Python-ideas
On Tue, Aug 14, 2018 at 10:45 AM, Rhodri James wrote: > On 'None is a constant': > > Erm. I think you've got carried away with simplifying this and gone down > a blind alley. None is a literal, and like any other literal can't be > rebound. no, it's not -- None is keyword, and just like any

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

2018-08-14 Thread Chris Barker via Python-ideas
On Tue, Aug 14, 2018 at 10:25 AM, David Mertz wrote: > Great work! There are a few typos, I'll try to get to a PR on those. > > I wonder if it's worth noting that None is a singleton, while 42 is just a > value. I.e. there might be several distinct objects that happen to be the > int 42, but not

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

2018-08-14 Thread Rhodri James
(Sorry to break threading on this. In a fit of idiocy I deleted the original email before realising I wanted to reply.) First off, thanks for doing this Jonathan. Documentation is usually a thankless task, so we ought to start by thanking you! I have a few comments on both content and

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

2018-08-14 Thread David Mertz
Great work! There are a few typos, I'll try to get to a PR on those. I wonder if it's worth noting that None is a singleton, while 42 is just a value. I.e. there might be several distinct objects that happen to be the int 42, but not so with None. Of course, in CPython, small integers are cached

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

2018-08-14 Thread Brice Parent
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

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

2018-08-14 Thread Jonathan Fine
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,

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

2018-07-26 Thread Chris Angelico
On Fri, Jul 27, 2018 at 9:20 AM, Michael Selik wrote: > On Mon, Jul 23, 2018 at 2:03 AM Jonathan Fine wrote: >> >> Thank you for your attention. What have I missed? > > > None and a few other things are special-cased by CPython. The compiler won't > bother to write bytecode instructions when an

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

2018-07-26 Thread Michael Selik
On Mon, Jul 23, 2018 at 2:03 AM Jonathan Fine wrote: > Thank you for your attention. What have I missed? > None and a few other things are special-cased by CPython. The compiler won't bother to write bytecode instructions when an if-statement obviously evaluates false. That might surprise some

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

2018-07-24 Thread Jonathan Fine
Here's another way that None is special. === >>> NoneType = type(None) >>> >>> class myNoneType(NoneType): pass ... Traceback (most recent call last): File "", line 1, in TypeError: type 'NoneType' is not an acceptable base type === For more information see

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

2018-07-23 Thread C Anthony Risinger
On Jul 23, 2018 8:43 PM, "Chris Barker - NOAA Federal via Python-ideas" < python-ideas@python.org> wrote: > Procedures return None > == a = [3,1,2] b = a.sort() a, b > ([1, 2, 3], None) This is less about None than about the convention that mutating methods return

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

2018-07-23 Thread Chris Barker - NOAA Federal via Python-ideas
I agree that some more docs on the specialness of None (and, to a lessor extent, True and False). A few comments: > None is a keyword > == None = 0 > SyntaxError: can't assign to keyword One of the implications of this is that “None” will always be the Singleton None object —

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

2018-07-23 Thread Chris Barker - NOAA Federal via Python-ideas
>lot. Actually, the ?. and ?[ > operators seem like they'd be much more useful if I did more JSON > processing - This has been mentioned a lot in this discussion— Maybe what we need is a smarter JSON processing package, rather than new operators. Granted, these operators would help the authors

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

2018-07-23 Thread Jörn Heissler
On Mon, Jul 23, 2018 at 10:03:10 +0100, Jonathan Fine wrote: > I thought, a page on how None is special would be nice. > I've not found such a page on the web. We do have > === > https://docs.python.org/3/library/constants.html Hi, there's also

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

2018-07-23 Thread David Mertz
I think your description of the uses of None is really great. There's definitely no reason it cannot be a blog post immediately, but perhaps at some later point included in The Python Tutorial. On Mon, Jul 23, 2018 at 8:39 AM Jonathan Fine wrote: > Hi Steve > > You wrote > > > I think your

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

2018-07-23 Thread Jonathan Fine
Hi Steve You wrote > I think your document would be a great blog post. I don't think it is > very helpful as part of the standard documention, as it is more a > collection of arbitrary facts about None than a coherent "big picture" > document. Thank you. That's nice. However, I think there is,

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

2018-07-23 Thread Jonathan Fine
Hi Steve In this thread you wrote, replying to Paul Moore's comments on PEP 505 > None is already a special value. It is so special, it is one of only > three built-in values given keyword status. All the other built-ins, > including such things that are used implicitly by the interpreter (such

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

2018-07-23 Thread Steven D'Aprano
On Mon, Jul 23, 2018 at 10:03:10AM +0100, Jonathan Fine wrote: > I thought, a page on how None is special would be nice. I think your document would be a great blog post. I don't think it is very helpful as part of the standard documention, as it is more a collection of arbitrary facts about

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

2018-07-23 Thread Jonathan Fine
Hi Paul Thank you for your contribution > The examples are interesting, agreed. One thing they highlight to me > is that most uses of None are effectively convention. The only two > behaviours that are unique to None and implemented in the interpreter > are: > > 1. Functions that don't return an

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

2018-07-23 Thread Paul Moore
On 23 July 2018 at 10:16, Steve Dower wrote: > On 23Jul2018 1003, Jonathan Fine wrote: >> >> This arises out of PEP 505 - None-aware operators. >> >> I thought, a page on how None is special would be nice. >> I've not found such a page on the web. We do have >> === >>

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

2018-07-23 Thread Steve Dower
On 23Jul2018 1003, Jonathan Fine wrote: This arises out of PEP 505 - None-aware operators. I thought, a page on how None is special would be nice. I've not found such a page on the web. We do have === https://docs.python.org/3/library/constants.html None The sole value of the type NoneType.

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

2018-07-23 Thread Jonathan Fine
This arises out of PEP 505 - None-aware operators. I thought, a page on how None is special would be nice. I've not found such a page on the web. We do have === https://docs.python.org/3/library/constants.html None The sole value of the type NoneType. None is frequently used to represent the