![]() |
what module is NoneType in? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: what module is NoneType in? (/thread-22822.html) Pages:
1
2
|
what module is NoneType in? - Skaperen - Nov-28-2019 what module is NoneType in? i didn't find it in the library, language, tutorial, or using documentation or in module "types".
RE: what module is NoneType in? - buran - Nov-28-2019 Not sure if this answers your question but look at https://docs.python.org/3/library/stdtypes.html#the-null-object RE: what module is NoneType in? - Gribouillis - Nov-28-2019 I think it is in module 'builtins' (with an s) RE: what module is NoneType in? - Skaperen - Nov-28-2019 (Nov-28-2019, 05:02 AM)buran Wrote: Not sure if this answers your question but look at https://docs.python.org/3/library/stdtypes.html#the-null-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__ .
RE: what module is NoneType in? - buran - Nov-28-2019 (Nov-28-2019, 03:23 PM)Skaperen Wrote: it does not even mention it.Well, it does; Quote:The Null Object¶ RE: what module is NoneType in? - Skaperen - Nov-29-2019 it doesn't mention "NoneType", which is what i am looking for. see post #1. RE: what module is NoneType in? - buran - Nov-29-2019 see the discussion here: https://stackoverflow.com/a/21706626/4046632 RE: what module is NoneType in? - Gribouillis - Nov-29-2019 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. RE: what module is NoneType in? - buran - Nov-29-2019 >>> __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.html#type-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 RE: what module is NoneType in? - Gribouillis - Nov-29-2019 You're misinterpreting the code >>> __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. |