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

Replace @properties, consider using attrs #477

Open
c24t opened this issue Jan 31, 2019 · 0 comments
Open

Replace @properties, consider using attrs #477

c24t opened this issue Jan 31, 2019 · 0 comments

Comments

@c24t
Copy link
Member

c24t commented Jan 31, 2019

Many classes needlessly wrap attributes in @propertys, e.g.

class Foo(object):
    def __init__(bar):
        self._bar = bar

    @property
    def bar(self):
        """The current bar value"""
        return self._bar

These should be replaced with plain old attributes.

While we're doing this, we should consider using the attrs library, which would let us remove some boilerplate code and provides AutoValue-style immutable value classes when we actually do want to protect certain attributes.

However, using attrs would mean adding a dependency on another third party library and making the code less readable (and more magical).

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

No branches or pull requests

2 participants