Skip to content

Instantly share code, notes, and snippets.

@gknoy gknoy/demo_attrs.py

Created Aug 25, 2016
Embed
What would you like to do?
Demo renaming `attr` library helpers to less-clever names
#
# 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
You can’t perform that action at this time.