1

The passstatement is usually a placeholder for future code and is used as a null operation.

But why it's not defined a type in Python. Should't it belong to None type?

Bikramjeet Singh
  • 681
  • 1
  • 7
  • 22

1 Answers1

5

Objects have types. Statements do not. pass is a statement, and does not have a type. (Also, None is not a type.)

user2357112
  • 260,549
  • 28
  • 431
  • 505
  • `None` is a `NoneType` object. `>>>> type(None) ` – deadvoid Oct 06 '18 at 20:09
  • @cryptonome: Yes, None is an object, so it is an instance of some type, specifically NoneType. That doesn't mean it *is* a type, though; I've seen a bunch of questions where people get confused about that. – user2357112 Oct 06 '18 at 20:25
  • given that `NoneType` is a class object from `object`, which is a metaclass from `type`, then `NoneType`, like the name suggested, derived from `type` just like any other `object`. check `help(NoneType)`. – deadvoid Oct 06 '18 at 20:36
  • @cryptonome: I can't tell what you're trying to say, and it doesn't seem relevant. `object` is not a metaclass, and "derived from `type` just like any other `object`" doesn't make sense. – user2357112 Oct 06 '18 at 20:39
  • ps: you said it in your answer, object has types. that contradicts the last statement you made, `None` is not a type`, since `None` _is_ an object. https://stackoverflow.com/a/6581949/10254804 – deadvoid Oct 06 '18 at 20:58
  • @cryptonome: I know what a metaclass is and how metaclasses work. The things you said still don't make sense. – user2357112 Oct 06 '18 at 21:03
  • Having a type and being a type are different things. – user2357112 Oct 06 '18 at 21:05
  • hmm i see, alright. I was going to argue further since `None` is a singleton but i understand your point now – deadvoid Oct 06 '18 at 21:09