Stress that attrs doesn't take away control
This commit is contained in:
parent
26a8c8c7b3
commit
d08753d2e1
17
docs/why.rst
17
docs/why.rst
|
@ -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__``?
|
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.
|
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)>
|
||||||
|
|
Loading…
Reference in New Issue