effectivepython icon indicating copy to clipboard operation
effectivepython copied to clipboard

Item 21 - class definition

Open jonfernandes opened this issue 5 years ago • 3 comments

The return statement is not within the method definition. i.e. it should be this

class Sorter:
...
def __call__(self, x):
        if x in self.group:
            self.found = True
            return (0, x)
        return (1, x)

NOT

class Sorter:
...
def __call__(self, x):
        if x in self.group:
            self.found = True
            return (0, x)
return (1, x)

jonfernandes avatar Feb 18 '20 11:02 jonfernandes

@jonfernandes Thanks for the report. I don't see it this way in my copy of the book. Can you provide more context about where you saw it this way? Was it an ebook version or kindle or something like that? Thanks

bslatkin avatar Feb 25 '20 16:02 bslatkin

@bslatkin I came here to report the same bug as well. Seems like @jonfernandes forgot to follow up on your question. Here's where I see it:

image

from https://learning.oreilly.com/library/view/effective-python-90/9780134854717/ch03.xhtml

cihati avatar May 10 '20 08:05 cihati

Gotcha. This appears to be an issue with the O'Reilly eBook specifically. I'll have to follow up with the publisher to figure this out. Thanks for the extra info @cihati!

bslatkin avatar May 19 '20 04:05 bslatkin

Going to follow up on this one for post-production

bslatkin avatar Jun 02 '24 03:06 bslatkin