Skip to content

Commit 9950845

Browse files
committed
Add doctest illustrating the usage of constructing dict from EntryPoints.
1 parent bde4e15 commit 9950845

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

importlib_metadata/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ def _for(self, dist):
138138

139139
def __iter__(self):
140140
"""
141-
Supply iter so one may construct dicts of EntryPoints easily.
141+
Supply iter so one may construct dicts of EntryPoints by name.
142+
143+
>>> eps = [EntryPoint('a', 'b', 'c'), EntryPoint('d', 'e', 'f')]
144+
>>> dict(eps)['a']
145+
EntryPoint(name='a', value='b', group='c')
142146
"""
143147
return iter((self.name, self))
144148

0 commit comments

Comments
 (0)