textedit icon indicating copy to clipboard operation
textedit copied to clipboard

Question on wordcount.py --> word_count method

Open fonsecapaulo opened this issue 6 years ago • 3 comments

Hi,

Small question of a Python newbie.

File: wordcount.py Method:

def word_count(self):
        """Returns a file's word count"""

        wc_file = self.open_file(self.filename)
        self = len(wc_file.split())
        return ("Words:", len(wc_file.split()))

Line 31: self = len(wc_file.split())

Why are you assigning this int to self? is this a bug?

Thanks Paulo

fonsecapaulo avatar Jun 13 '18 14:06 fonsecapaulo

Yup, it's a bug. Thanks for pointing it out. Feel free to open a pull request :)

veekaybee avatar Jun 25 '18 19:06 veekaybee

Done, my first pull request :)

fonsecapaulo avatar Jul 18 '18 21:07 fonsecapaulo

Hi Vicki, Thanks for accepting the pull request, just one more thing, maybe it good to update the blog post http://veekaybee.github.io/2017/09/26/python-packaging/ with this correction, actually this was where i found the bug in the first place.

Thanks Paulo

fonsecapaulo avatar Jul 20 '18 07:07 fonsecapaulo