extract named fields from the tuples in table difference remove one set' tuples from another these operations go beyond the tools provided by python' built-in set objectand are prime example of why you may wish to implement custom set type in the first place although have ported this code to run under python xi have not revisited it in any sort of depth for this editionbecause today would probably prefer to implement it as subclass of the built-in set typerather than part of proprietary set implementation coincidentallythat leads us to our next topic subclassing built-in types before we move on to other classical data structuresthere is one more twist in the stack and set story in recent python releasesit is also possible to subclass built-in datatypes such as lists and dictionariesin order to extend them that isbecause datatypes are now themselves customizable classeswe can code unique datatypes that are extensions of built-inswith subclasses that inherit built-in tool sets this is especially true in python xwhere "typeand "classhave become veritable synonyms altogether to demonstrateexample - shows the main parts of module containing variants of our stack and set objects coded in the prior sectionsrevised as customized lists for varietythe set union method has also been simplified slightly here to remove redundant loop example - pp \dstruct\basic\typesubclass py "customize built-in types to extendinstead of starting from scratchclass stack(list)" list with extra methodsdef top(self)return self[- def push(selfitem)list append(selfitemdef pop(self)if not selfreturn none elsereturn list pop(selfavoid exception class set(list) list with extra methods and operatorsdef __init__(selfvalue=[])on object creation list __init__(selfself concat(valuesubclassing built-in types