metaclasses for type comparison

Simon Burton simonb at webone.com.au
Thu Sep 11 00:48:48 EDT 2003


On Thu, 11 Sep 2003 03:03:02 +0000, David C. Fox wrote:

...
>> B < A # should be True
> 
> Is this an exercise to help you learn about metaclasses, or do you 
> actually want to be able to check whether B is a subclass of A.  If the 
> latter, then try issubclass(B, A).  Otherwise, ignore this comment
> 
> David

Both. Well, aha, "issubclass" makes my implementation
of ge/le and friends a bit silly. Actually i was annoyed 
with "isinstance", it seems like it should be part of the syntax 
(eg."<="). Look at this: "issubclass". It has 10 chars!!

Lazy when i can be,

Simon Burton.






More information about the Python-list mailing list