[issue19438] Where is NoneType in Python 3?

2020-10-21 Thread Andrés Delfino

Andrés Delfino  added the comment:

As per https://github.com/python/cpython/pull/22336 I believe this issue can be 
closed now.

My PR is not relevant to the problem stated by OP, so I'm "unlinking" it.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19438] Where is NoneType in Python 3?

2020-09-09 Thread Andrés Delfino

Andrés Delfino  added the comment:

ammar2 found this mail mentioning the changes in that commit 
https://mail.python.org/pipermail/python-dev/2007-November/075386.html

"I've removed the 'new' module from py3k and also removed a lot of types
from the 'types' module in py3k. It only contains types that aren't
easily available through builtins."

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19438] Where is NoneType in Python 3?

2020-09-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the link.  It looks like NoneType got inadvertently caught up in the 
sweep of names that had direct synonyms.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19438] Where is NoneType in Python 3?

2020-09-08 Thread Andrés Delfino

Andrés Delfino  added the comment:

types.NoneType was removed here: 
https://github.com/python/cpython/commit/c9543e42330e5f339d6419eba6a8c5a61a39aeca#diff-0f021aec4e35b86a3160d44069dec997

The thing of adding NoneType to types that is somewhat unpleasing to me is that 
it's named exactly as the actual type. Seems confusing.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19438] Where is NoneType in Python 3?

2020-09-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I would support adding NoneType back to the types module.  Am not sure why it 
was ever removed.  It has a much reason to exists as types.FunctionType which 
is a clear, well-named short-cut for "type(lambda :None)".

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19438] Where is NoneType in Python 3?

2020-09-08 Thread Andrés Delfino

Change by Andrés Delfino :


--
keywords: +patch
nosy: +adelfino
nosy_count: 3.0 -> 4.0
pull_requests: +21235
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22161

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19438] Where is NoneType in Python 3?

2013-11-17 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


--
nosy:  -christian.heimes
priority: normal - low
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19438
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19438] Where is NoneType in Python 3?

2013-10-29 Thread Christian Heimes

Christian Heimes added the comment:

How about:

type(v) in (bytes, type(None))

or:

   isinstance(v, (bytes, type(None))

or:

   v is None or type(v) is bytes

or:

  v is None or isinstance(v, bytes)

--
nosy: +christian.heimes

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19438
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19438] Where is NoneType in Python 3?

2013-10-29 Thread mpb

New submission from mpb:

types.NoneType seems to have disappeared in Python 3.  This is probably 
intentional, but I cannot figure out how to test if a variable is of type 
NoneType in Python 3.

Specifically, I want to write:
assert  type (v) in ( bytes, types.NoneType )

Yes, I could write:
assert  v is None or type (v) is bytes

But the first assert statement is easier to read (IMO).

Here are links to various Python 3 documentation about None:

[1] http://docs.python.org/3/library/stdtypes.html#index-2

[2] http://docs.python.org/3/library/constants.html#None

Link [2] says: None  The sole value of the type NoneType.  However, NoneType 
is not listed in the Python 3 documentation index.  (As compared with the 
Python 2 index, where NoneType is listed.)

[3] http://docs.python.org/3/library/types.html

If NoneType is gone in Python 3, mention of NoneType should probably be removed 
from link [2].  If NoneType is present in Python 3, the docs (presumably at 
least one of the above links, and hopefully also the index) should tell me how 
to use it.

Here is another link:

[4] http://docs.python.org/3/library/stdtypes.html#bltin-type-objects

The standard module types defines names for all standard built-in types.  
(Except class 'NoneType' ???)

None is a built-in constant.  It has a type.  If None's type is not considered 
to be a standard built-in type, then IMO this is surprising(!!) and should be 
documented somewhere (for example, at link [4], and possibly elsewhere as well.)

Thanks!

--
assignee: docs@python
components: Documentation
messages: 201666
nosy: docs@python, mpb
priority: normal
severity: normal
status: open
title: Where is NoneType in Python 3?
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19438
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19438] Where is NoneType in Python 3?

2013-10-29 Thread mpb

mpb added the comment:

Of your 4 suggestions, I mentioned #3 and #4 in my post.  They are less 
readable, IMO.

1 and 2 are nicer, but both have an extra set of nested parenthesis.

While I appreciate the suggestions, I submitted this as a documentation bug, 
because I think I should be able to find these suggestions somewhere in the 
Python 3 documentation, at one (or more) of the links I included in my bug 
report.  Also, the Python 3 documentation does mention NoneType, and if 
NoneType is not part of Python 3, I claim this is an error in the documentation.

And then, there is my personal favorite work-around:

NoneType = type (None)# only needed once
assert type (v) in ( bytes, NoneType )

Or (perhaps more confusingly, LOL!):

none = type (None)
assert type (v) in ( bytes, none )

isinstance is more confusing because it takes two arguments.  Whenever I use it 
I have to think, isinstance vs instanceof, which is Python, which is Java?  
(And I haven't used Java seriously in years!)  And then I have to think about 
the order of the arguments (v, cls) vs (cls, v).  type is just simpler than 
isinstance.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19438
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19438] Where is NoneType in Python 3?

2013-10-29 Thread R. David Murray

R. David Murray added the comment:

See http://www.python.org/dev/peps/pep-0294/ for some background on this.  The 
unexpected thing is actually that the types module still exists at all in 
Python3 :)

That said, its documentation could, indeed, use some improvement to address 
this kind of question.

Searching the python-dev email list for 'NoneType removal types module turns 
up some interesting posts, back in the 2.3 days...basically, type(None) is the 
One True Way to get NoneType :)

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19438
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19438] Where is NoneType in Python 3?

2013-10-29 Thread mpb

mpb added the comment:

Regarding http://www.python.org/dev/peps/pep-0294/ ...

Complete removal of the types module makes more sense to me than letting types 
continue, but removing NoneType from it!

If type(None) is the one_true_way, then the docs should say that, possibly in 
multiple locations.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19438
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com