12.07.2015 Views

Is Python a

Is Python a

Is Python a

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

f. How would you go about emulating other list operations in the set class?(Hints: _ _add_ _ can catch concatenation, and _ _getattr_ _ can pass mostlist method calls off to the wrapped list.)6. Class tree links. In “Namespaces: The Whole Story” in Chapter 24, and “MultipleInheritance” in Chapter 25, I mentioned that classes have a _ _bases_ _attribute that returns a tuple of their superclass objects (the ones in parenthesesin the class header). Use _ _bases_ _ to extend the Lister mix-in class (seeChapter 25) so that it prints the names of the immediate superclasses of theinstance’s class. When you’re done, the first line of the string representationshould look like this (your address may vary):

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!