Skip to content
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

Easier way to do it! #1

Open
rec opened this issue Jun 14, 2018 · 0 comments
Open

Easier way to do it! #1

rec opened this issue Jun 14, 2018 · 0 comments

Comments

@rec
Copy link

rec commented Jun 14, 2018

Since I was here:

https://github.com/estiens/bibliopixel_projects/blob/9a2665d2e93dcf0d849865c9714d55883513570e/api/animations/base_remote_strip.py#L3-7

This could just be:

class BaseRemoteStrip(BaseStripAnim):
    color_control = 0
    brightness_control = 100

Exactly the same effect, shorter, and it fixes the bug you have in your version, where you forgot to pass **args into the parent constructor.

:-)

Also, I suggest you not use protected (single _) variables at all! There's no compelling use case for them. They're all visible to children, so you have to preserve them as part of the API, so might as well make them public.

Private variables starting with __ are in fact hidden (mostly) but really, why bother?

The issue is "bondage vs discipline" :-D

Python is a more discipline-oriented language - let people change these variables if they like, particularly since they get to see your source code.

Particularly, you are actually changing these variables from other classes, so they aren't "protected" at all, now are they?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant