print(aplanet)
Showing posts with label Chapter 10. Show all posts
Showing posts with label Chapter 10. Show all posts
Wednesday, September 23, 2009
Chapter 10 Listing 10.9
The print on line 20 is missing parenthesis around the argument. The line should read:
Chapter 10 Exercise 10.17
The
__getslice__
method does not exist anymore. The same functionality can be implemented bye writing your own __getitem__
method.Thursday, April 23, 2009
Exercises 10.19, 20, 21
In Python 3.0 the
You can implement any or all of these special methods for exercises 10.19, 10.20, and 10.21.
__cmp__
special method was removed. In favor of keeping __lt__, __le__, __gt__, __ge__, __eq__, and __neq__
. In the 'good old days' if you wrote __cmp__
that would suffice for any of the comparison operators. Now you must explicitly write a method for each comparison operator you want to write. If it seems weird and confusing you are right, in fact it took until Python 3.0.1 for the core python developers to truly rid the language of cmp.You can implement any or all of these special methods for exercises 10.19, 10.20, and 10.21.
Subscribe to:
Posts (Atom)