Chris Angelico wrote: > On Wed, Oct 14, 2015 at 8:55 PM, NewsLeecher User <newsleec...@spam.com> > wrote: >> #class example >> class SayMyName: >> def __init__(self, myname): >> self.myname = myname >> def say(self): >> print "Hello, my name is", self.myname > > Side point: This is a poor example for _any_ Python. In Py2, that > makes an old-style class, which will work fine until you try to use a > feature that it can't handle, and then you'll wonder what on earth is > wrong. And in Py3, the print calls need their parens. But it's a > pointless example of a class, which leaves you wondering why a better > example couldn't be found... > > Definitely look for a better book, preferably one aimed at Python 3.4 or > 3.5.
If I were to write a book about Python 2 I would defer the "always inherit from object" mantra until the features that require newstyle classes are introduced. In any way, judging a book from one example you disagree with is premature. Personally I expect to find many minor nits in the most excellent book. OP, the differences between Python 2 and Python 3 are big enough to make the attempt to learn one with a book using the other a rather displeasant experience. Either switch to a book that is geared at Python 3 (recommended, particularly if you speak a language using non-ascii letters) or install Python 2 and run the examples from your current book with the older 2.7 interpreter. -- https://mail.python.org/mailman/listinfo/python-list