8 ms·
Note that this doesn't actually encompass all the possible usages of the PEP-572 operator in the standard library, of which there appear to be 312 more candidat
by hchasestevens 8y ago
Note that this doesn't actually encompass all the possible usages of the PEP-572 operator in the standard library, of which there appear to be 312 more candidates (and a further 100 in the rest of CPython):
root@8d88e1e678b0:/cpython# astpath -A 1 "//Assign[(targets/Name/@id = following-sibling::*[1][name(.) = 'If']/test/Name/@id)]" > pep-572.txt
root@8d88e1e678b0:/cpython# grep "Lib" pep-572.txt | head -20
./Lib/argparse.py:284 > help = self._root_section.format_help()
./Lib/argparse.py:285 if help:
./Lib/argparse.py:2275 > a = [action for action in positionals
./Lib/argparse.py:2276 if action.nargs in [PARSER, REMAINDER]]
./Lib/cmd.py:300 > doc=getattr(self, 'do_' + arg).__doc__
./Lib/cmd.py:301 if doc:
./Lib/cmd.py:356 > nonstrings = [i for i in range(len(list))
./Lib/cmd.py:357 if not isinstance(list[i], str)]
./Lib/compileall.py:123 > mo = rx.search(fullname)
./Lib/compileall.py:124 if mo:
./Lib/dis.py:386 > show_lineno = linestarts is not None
./Lib/dis.py:387 if show_lineno:
./Lib/dis.py:403 > new_source_line = (show_lineno and
./Lib/dis.py:404 instr.starts_line is not None and
./Lib/enum.py:86 > already = set(value) & set(self._member_names)
./Lib/enum.py:87 if already:
./Lib/enum.py:153 > invalid_names = set(enum_members) & {'mro', }
./Lib/enum.py:154 if invalid_names:
./Lib/enum.py:848 > negative = value < 0
./Lib/enum.py:849 # issue29167: wrap accesses to _value2member_map_ in a list to avoid race
root@8d88e1e678b0:/cpython# grep -E "\.py\:[^w]+>" pep-572.txt | wc -l
412
root@8d88e1e678b0:/cpython# grep -E "/Lib/.+\.py\:[^w]+>" pep-572.txt | wc -l
312