Nov-28-2019, 04:54 AM
Pages: 1 2
Nov-28-2019, 05:02 AM
Not sure if this answers your question but look at https://docs.python.org/3/library/stdtyp...ull-object
Nov-28-2019, 12:07 PM
I think it is in module 'builtins' (with an s)
Nov-28-2019, 03:23 PM
(Nov-28-2019, 05:02 AM)buran Wrote: [ -> ]Not sure if this answers your question but look at https://docs.python.org/3/library/stdtyp...ull-object
no, it does not even mention it.
(Nov-28-2019, 12:07 PM)Gribouillis Wrote: [ -> ]I think it is in module 'builtins' (with an s)
seems to be the same thing as already there as
__builtins__
.Nov-28-2019, 03:34 PM
(Nov-28-2019, 03:23 PM)Skaperen Wrote: [ -> ]it does not even mention it.Well, it does;
Quote:The Null Object¶
This object is returned by functions that don’t explicitly return a value. It supports no special operations. There is exactly one null object, named None (a built-in name). type(None)() produces the same singleton.
It is written as None.
Nov-29-2019, 08:59 AM
it doesn't mention "NoneType", which is what i am looking for. see post #1.
Nov-29-2019, 09:26 AM
see the discussion here: https://stackoverflow.com/a/21706626/4046632
Nov-29-2019, 10:02 AM
However
>>> type(None).__module__ 'builtins'but
>>> __builtins__.NoneType Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'builtins' has no attribute 'NoneType'Thus NoneType is hidden.
Nov-29-2019, 10:09 AM
>>> __builtins__.type(None) <class 'NoneType'>
Also there is very interesting link in one of the comments in the SO
https://docs.python.org/3/library/typing...pe-aliases
Quote:Note that None as a type hint is a special case and is replaced by type(None).
As I understand it, in python3
NoneType
is only exposed through type(None)
And the question is why @Skaperen asked this question in the first place as it starts to look very much like XY problem
Nov-29-2019, 10:19 AM
You're misinterpreting the code
You can add the type yourself
>>> __builtins__.type <class 'type'>so
__builtins__.type(None)
is identical to type(None)
You can add the type yourself
>>> __builtins__.NoneType = type(None) >>> NoneType <class 'NoneType'>This bug report seems worth reading as well.
Pages: 1 2