New submission from Nick Coghlan <[email protected]>:
At the core dev sprints in 2017 (IIRC), Ezio and I were talking about some of
the potential issues with 3.10, and one of them was folks attempting to
manipulate sys.version with string operations rather than using the already
decomposed sys.version info.
Anthony Sottile has recently been experimenting with a Python build patched to
report itself as 3.10 to see what breaks, and indicated that many of the
failures were due to that kind of problem (in particular: writing
"sys.version[:3]" instead of "'{}.{}'.format(sys.version_info[:2])")
One possible remedy that Ezio and I discussed was the idea of an "OpaqueString"
type that presented as a string, but raised an error if you tried any
operations that assumed it could be meaningfully decomposed
character-by-character.
This would probably need to be a string subclass for compatibility, and would
need a transitional variant that only emitted deprecation warnings rather than
failing outright.
----------
messages: 348213
nosy: ezio.melotti, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Deprecate slicing and ordering operations on sys.version
type: enhancement
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37636>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com