Stress that attrs doesn't take away control

This commit is contained in:
Hynek Schlawack 2017-08-21 10:29:42 +02:00
parent 26a8c8c7b3
commit d08753d2e1
1 changed files with 16 additions and 1 deletions

View File

@ -228,4 +228,19 @@ Also: no tests whatsoever.
And who will guarantee you, that you don't accidentally flip the ``<`` in your tenth implementation of ``__gt__``?
If you don't care and like typing, we're not gonna stop you.
But if you ever get sick of the repetitiveness, ``attrs`` will be waiting for you. :)
But if you ever get sick of the repetitiveness, ``attrs`` will be waiting for you.
It also should be noted that ``attrs`` is not an all-or-nothing solution.
You can freely choose which features you want and disable those that you want more control over:
.. doctest::
>>> @attr.s(repr=False)
... class SmartClass(object):
... a = attr.ib()
... b = attr.ib()
...
... def __repr__(self):
... return "<SmartClass(a=%d)>" % (self.a,)
>>> SmartClass(1, 2)
<SmartClass(a=1)>