* Use an f-string for improved readability
* Put version notes in chronological order
def stdev(self):
return statistics.stdev(self._data)
+ .. versionadded:: 3.8
.. versionchanged:: 3.12
Prior to Python 3.12, ``cached_property`` included an undocumented lock to
per-instance, which could result in unacceptably high lock contention. In
Python 3.12+ this locking is removed.
- .. versionadded:: 3.8
-
.. function:: cmp_to_key(func)
@lru_cache(maxsize=32)
def get_pep(num):
'Retrieve text of a Python Enhancement Proposal'
- resource = 'https://peps.python.org/pep-%04d/' % num
+ resource = f'https://peps.python.org/pep-{num:04d}'
try:
with urllib.request.urlopen(resource) as s:
return s.read()