Created
August 25, 2016 21:19
-
-
Save gknoy/6e884fce3edda08a1566823fec37ba70 to your computer and use it in GitHub Desktop.
Demo renaming `attr` library helpers to less-clever names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# demo_attrs | |
# | |
import attr | |
@attr.s | |
class Foo(object): | |
x = attr.ib() | |
y = attr.ib() | |
from attr import ( | |
s as AttributedModel, | |
ib as attribute, | |
) | |
@AttributedModel | |
class Bar(object): | |
x = attribute() | |
y = attribute() | |
def main(): | |
foo = Foo(x=1, y=2) | |
bar = Bar(x=1, y=2) | |
print('foo', foo) | |
print('bar', bar) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment