Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
The scanf() translation table primarily serves as a way to learn regex syntax for people who only know scanf syntax. It would defeat the educational purpose to immortalize the translation as fixed constants. For the most part, people are better off writing their own customizations, for example not using [+-] unless a sign is known to be present. Also, the table in the docs provides a translation between scanf tokens and regex patterns, but it does not assign names to each pattern. The PR adds names but makes confusing choices. For example, \S+ in regex notation means "longest sequence contiguous sequence of non-space characters". In the PR, '\S+' is aliased with "whitespace" which is the opposite of its usual meaning. Another problem with the new names is that they take C scanf specific definitions and put them in a Python context where we use the words differently. For example, "octal" in scanf means "[-+]?[0-7]+" but in Python oct(333) would give '0o515' which includes an 'o' and does not include a '+'. Overall, I think it would be a mistake to put C world specific aliases into Python world. Instead, it would be better to just leave the table for education purposes as it is now. ---------- assignee: -> rhettinger nosy: +rhettinger _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45956> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com