veekaybee / textedit

A super-mini Python text editor
78 stars 22 forks source link

Question on wordcount.py --> word_count method #6

Open fonsecapaulo opened 6 years ago

fonsecapaulo commented 6 years ago

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

veekaybee commented 6 years ago

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

fonsecapaulo commented 6 years ago

Done, my first pull request :)

fonsecapaulo commented 6 years ago

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