-
-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sopel: use python3 style class and abc.ABC #2138
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could resolve the merge conflict manually (it's trivial), but there are a few other things.
53caa7d
to
dc836bc
Compare
In Python 2, there was 2 styles: * `class ClassName:` * `class ClassName(object)` And they behaved differently, and using `super()` is different too. However, in Python3, both are equivalent to doing the second style, and we can use `super()` directly. So, yeah. Yet another weird thing about py2/py3.
And also add some type hint when easy to do so.
dc836bc
to
9f83a59
Compare
Fixed merge conflict. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely leaned on GitHub to show me which files were changed since the last review. My little nitpicks are all taken care of, so let's mark this as ready to ship.
Description
In Python 2, there was 2 styles:
class ClassName:
class ClassName(object)
And they behaved differently, and using
super()
is different too. However, in Python3, both are equivalent to doing the second style, and we can usesuper()
directly. I remember having to work with Py2.4 compatible code in my career, and this "new style class" stuff was... a pure nightmare. I'm just glad we can get rid of this.Also, there is now
abc.ABC
that allows to describe an abstract class as being abstract. This is interesting because it doesn't require to addraise NotImplementedError
anymore: a few decorators and it's all good!One last thing: I added few type hint here and there, and I had fun with
TypeVar
. It's looking good!Note: I think I want a "housekeeping" or "cleaning code" label or something. 😁
Checklist
make qa
(runsmake quality
andmake test
)