Python23: cannot inherit from bool?

Delaney, Timothy tdelaney at avaya.com
Tue Jan 14 21:19:54 EST 2003


> From: franks at mcs.anl.gov [mailto:franks at mcs.anl.gov]
> 
> It seems that 2.3 doesn't allow you to inherit from bool:
> Could someone explain the reason for this restriction?

`bool` is a special class which is guaranteed to only ever have two
instances instantiated (a dualton if you will) - True and False.

Allowing `bool` to be subclassed would break this guarantee.

Tim Delaney





More information about the Python-list mailing list