Feature or enhancement
Proposal:
Description
Lib/uuid.py currently uses older string formatting methods (% operator and .format()) in a few places. This task resolves to modernizing these to use f-strings (PEP 498) for improved readability and consistency with modern Python codebases.
Proposed Changes
- Replace
'%s(%r)' % (self.__class__.__name__, str(self)) with f'{self.__class__.__name__}({str(self)!r})' in UUID.__repr__.
- Replace
os.fsencode('(%s)' % ip_addr) with os.fsencode(f'({ip_addr})') in _arp_getnode.
- Replace
assert False, '_random_getnode() returned invalid value: {}'.format(_node) with f-string version in getnode.
Verification
- Run
python Lib/test/test_uuid.py to ensure all tests pass.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
Feature or enhancement
Proposal:
Description
Lib/uuid.pycurrently uses older string formatting methods (%operator and.format()) in a few places. This task resolves to modernizing these to use f-strings (PEP 498) for improved readability and consistency with modern Python codebases.Proposed Changes
'%s(%r)' % (self.__class__.__name__, str(self))withf'{self.__class__.__name__}({str(self)!r})'inUUID.__repr__.os.fsencode('(%s)' % ip_addr)withos.fsencode(f'({ip_addr})')in_arp_getnode.assert False, '_random_getnode() returned invalid value: {}'.format(_node)withf-stringversion ingetnode.Verification
python Lib/test/test_uuid.pyto ensure all tests pass.Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs