Python23: cannot inherit from bool?

Martin v. Löwis martin at v.loewis.de
Wed Jan 15 01:37:52 EST 2003


Carl Banks <imbosol at vt.edu> writes:

> This reminds me of a question I've been pondering, in case anyone
> knows: Is it the plan that built-in singleton objects (None, Ellipsis,
> NotImplemented, ?) will eventually get a new metatype?  

To my knowledge, no.

> Although it seems like there would be small benefit for built-in
> objects (the only tangible thing I can think of is you could ask a
> singleton type for its object), it could be used for Python types,
> too.

What specific functionality would you expect to see in this metatype?

For a C-implemented type, all you have to do is to leave out the
tp_new slot, then creating new instances by calling the type will
cause TypeErrors.

For a Python-implemented type (i.e. a newstyle class), not being able
to call the class to create an instance is not helpful: how would you
then create the single instance?

Regards,
Martin





More information about the Python-list mailing list