Skip to content

Commit

Permalink
Better 2.7 example
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Dec 27, 2021
1 parent d4e3220 commit b4dc9b0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -476,17 +476,18 @@ Types

.. doctest::

>>> from attrs import attrib, fields
>>> from attrs import fields

>>> @define
... class C:
... x: int
>>> fields(C).x.type
<class 'int'>

>>> @define
... class C:
... x = attrib(type=int)
>>> import attr
>>> @attr.s
... class C(object):
... x = attr.ib(type=int)
>>> fields(C).x.type
<class 'int'>

Expand Down

0 comments on commit b4dc9b0

Please sign in to comment.