Skip to content

Commit da612e2

Browse files
committed
Readme: recommend ItemAdapter.is_item
1 parent d9bb5f4 commit da612e2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Consider the following type definition:
5757

5858
```python
5959
>>> from dataclasses import dataclass
60-
>>> from itemadapter import ItemAdapter, is_item
60+
>>> from itemadapter import ItemAdapter
6161
>>> @dataclass
6262
... class InventoryItem:
6363
... name: str
@@ -70,7 +70,7 @@ An `ItemAdapter` object can be treated much like a dictionary:
7070

7171
```python
7272
>>> obj = InventoryItem(name='foo', price=20.5, stock=10)
73-
>>> is_item(obj)
73+
>>> ItemAdapter.is_item(obj)
7474
True
7575
>>> adapter = ItemAdapter(obj)
7676
>>> len(adapter)
@@ -218,7 +218,8 @@ calling `dict(adapter)`, because it's applied recursively to nested items (if th
218218
### function `itemadapter.utils.is_item(obj: Any) -> bool`
219219

220220
Return `True` if the given object belongs to (at least) one of the supported types,
221-
`False` otherwise. This is an alias for `itemadapter.adapter.ItemAdapter.is_item`.
221+
`False` otherwise. This is an alias, using the `itemadapter.adapter.ItemAdapter.is_item`
222+
class method is encouraged for better performance.
222223

223224

224225
### function `itemadapter.utils.get_field_meta_from_class(item_class: type, field_name: str) -> types.MappingProxyType`

0 commit comments

Comments
 (0)