-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Library: Port 'Video' to Python #728
Conversation
video.set_file(Gio.File.new_for_uri(workbench.resolve("./workbench-video.mp4"))) | ||
|
||
|
||
def on_pressed(*_): |
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.
Not very sure if this is the best way - it gets 4 parameters that we don't care about
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.
*_
is a bit odd style, normally this is always called *args
, but it's OK.
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.
But yeah this is kind of the way to go if you don't care about the signal's parameters.
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.
Let's be consistent with code style 🙏
@theCapypara you can document Python code style in https://github.com/sonnyp/Workbench/wiki/Style-Guide
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.
So should I change it to "args" or leave it as "_" to indicate that they are discarded?
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 know we already merged a few PRs with *_
but I would really prefer *args
.
@sonnyp I'll do that later once the storm of demo PRs is done, I'll also see if we can add linting then, it would probably point this out.
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.
What about methods that have multiple discards like lambda _, __
should it become lambda *args
? And what about lambda x, _, y, __
?
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.
In the first case, yes. In the second you could do x, _a, y, _b
if it's just one extra argument or also x, _a, y, *args
in general.
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.
LGTM. Thank you! The only thing to note was the *_
naming, see inline comments. However we will deal with this when we add linting later.
No description provided.