You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should we use self.set_title(title="...") instead #200
For me, if subclassed, code it as really subclassed .. that was the thought.. (So I am not so keen on all the super() things, after all. Please read on.)
Let me re-remind you that one code was in python2 style. layout_listbox_example.py at:
super(Gtk.ListBoxRow, self).__init__()
Considering the reason behind adopting the syntax change on super() with PEP-3135, at least, we need to get rid of this old python2 syntax code in tutorial document. https://www.python.org/dev/peps/pep-3135/#rationale
Maybe I am wrong. But this and the following are what I saw today by poking upstream documents which seems to demand more style changes.
As I learn more on coding in Python, subclassing seems to be a bad idea these days for overhead etc.
As a tutorial, complicating code by subclass may not be desirable thing if it has clear merits. For example, Section 6.1.1 Examples can be as simple as the following without class:
I agree that using Python 3's super() is a good idea, but is unrelated
to this.
I'm not sure what you are proposing at this point, get rid of keyword
argument in super calls, or sub-classes in general?
I don't think PyGObject is outlawing sub-classes in general, because it
would essentially discard the object-oriented nature of Python. I think
what they are saying is that overriding methods can be problematic.
Activity
sebp commentedon Jul 6, 2021
It's not a big difference, IMHO. I think it's clear what the code's intent is. I would leave it as it is.
osamuaoki commentedon Jul 6, 2021
For me, if subclassed, code it as really subclassed .. that was the thought.. (So I am not so keen on all the super() things, after all. Please read on.)
Let me re-remind you that one code was in python2 style. layout_listbox_example.py at:
Considering the reason behind adopting the syntax change on super() with PEP-3135, at least, we need to get rid of this old python2 syntax code in tutorial document. https://www.python.org/dev/peps/pep-3135/#rationale
Maybe I am wrong. But this and the following are what I saw today by poking upstream documents which seems to demand more style changes.
As I learn more on coding in Python, subclassing seems to be a bad idea these days for overhead etc.
The example code by the upstream pyobject developer doesn't use subclass with
__init__like this tutorial.Gtk.Template codes, of course, need class but no
__init__used like ones in other parts of this tutorial..As a tutorial, complicating code by subclass may not be desirable thing if it has clear merits. For example, Section 6.1.1 Examples can be as simple as the following without class:
Although, we are more likely to use Gtk.Template, it is very educational how each Gtk components are used.
I thank your effort which gave me good heads up. Thank you.
sebp commentedon Jul 8, 2021