2

I was just wondering if in Python there's any other object/instance whose type is NoneType type besides the very well known None:

>>> type(None)
<type 'NoneType'>

So... This is very clear, but I was wondering whether there's anything else that is also of NoneType

>>> type(???)
<type 'NoneType'>

Needless to say, this is just for curiosity sake and learning purposes :-)

Thank you in advance.

Savir
  • 17,568
  • 15
  • 82
  • 136
  • See [this answer](https://stackoverflow.com/a/21095702/1084416) to this question: [What is a `NoneType` object?](https://stackoverflow.com/questions/21095654/what-is-a-nonetype-object) – Peter Wood Aug 22 '17 at 22:08
  • Welp, if an answer answers a question in an indirect dupe, it's still a dupe. – cs95 Aug 22 '17 at 22:09
  • You're right... it's a duplicate (I saw that question, and I didn't get as far as to reach the 3rd entry) I'll accept the first answer and remove it – Savir Aug 22 '17 at 22:10
  • 2
    @BorrajaX Relax. There's nothing wrong with dupes. They serve as checkpoints to guide people who enter different search terms but are looking for the same thing. – cs95 Aug 22 '17 at 22:10
  • 1
    See also the source code: [`object.c`](https://github.com/python/cpython/blob/a66f9c6bb134561a24374f10e8c35417d356ce14/Objects/object.c#L1548) – Peter Wood Aug 22 '17 at 22:18
  • Ok... That makes sense @cᴏʟᴅsᴘᴇᴇᴅ ... I'll keep it for now. Thank you. – Savir Aug 22 '17 at 22:23

2 Answers2

8

From the docs, None is:

The sole value of the type NoneType.

cs95
  • 379,657
  • 97
  • 704
  • 746
Robbie Jones
  • 391
  • 1
  • 7
3

None is the only NoneType , however in your case of

>>> type(???)
<type 'NoneType'>

You could do something like

>>> a=None
>>> type(a)
type 'NoneType'

Meaning, any variable that holds None will obviously also return NoneType as its type since they are None.

Davy M
  • 1,697
  • 4
  • 20
  • 27
  • `a` is not a value; it's just another name that refers to the singleton value of type `NoneType`. – chepner Aug 22 '17 at 22:12
  • That's why I included the example with `a` , since the asker's question wonders `whether there's anything else`, so I took that to include names that refers to the very same `NoneType`. – Davy M Aug 22 '17 at 22:15