Skip to content

Commit f8a7887

Browse files
committed
Prefer a cached property, as the property is likely to be retrieved at least 3 times (on construction and for module:attr access).
1 parent 24c79ea commit f8a7887

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

importlib_metadata/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def attr(self) -> str:
232232
def extras(self) -> List[str]:
233233
return re.findall(r'\w+', self._match.extras or '')
234234

235-
@property
235+
@functools.cached_property
236236
def _match(self) -> _EntryPointMatch:
237237
match = self.pattern.match(self.value)
238238
if not match:

0 commit comments

Comments
 (0)