Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
slots=True is incompatible with str=True #198
>>> import attr >>> @attr.s(str=True, slots=True) ... class Foo(object): ... x = attr.ib() ... >>> f = Foo(1) >>> str(f) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unbound method repr_() must be called with Foo instance as first argument (got nothing instead)
Python 2.7.13, attrs==17.2.0
FTR this is a Python 2-bug only:
Python 3.6.1 (default, May 4 2017, 15:25:00) Type 'copyright', 'credits' or 'license' for more information IPython 6.0.0 -- An enhanced Interactive Python. Type '?' for help. In : import attr In : @attr.s(str=True, slots=True) ...: class C: ...: x = attr.ib() ...: In : str(C(1)) Out: 'C(x=1)'
(I was surprised about this bug repost because I use it all the time :))