python / cpython

The Python programming language
https://www.python.org
Other
63.45k stars 30.38k forks source link

typo ? #106709

Closed qqwqqw689 closed 1 year ago

qqwqqw689 commented 1 year ago

7d010004bffa9fadbbadb8450c38955

in cpython/Lib/subprocess.py

terryjreedy commented 1 year ago

The ()s are meant to indicate that the instances are waited for by calling the wait function. It is a non-standard English usage and it could be argued a bit too esoteric. (It you are pointing at 'synchronously', say so.) Let's get some other opinions.

SectorCorruptor commented 1 year ago

Pretty sure this would be found in many other program docs, although I can't prove it...

qqwqqw689 commented 1 year ago

Ok,thanks.

SectorCorruptor commented 1 year ago

For the sake of proving, I have done a rather minimal search, using Python basic rules for identifiers, and have found a total of 8 such 'typos' for a very minimal search that finds similar examples including ed, s, and ing. It only checks the __init__ of packages, yet with such a restricted regex, it has found 8 of these. I'm sure that if I had expanded my search, I could have found more.

Trying to fix just this issue will raise consistency errors, and besides as @terryjreedy has already mentioned, this form of typing is used to indicate the function is being executed.

For reference, this is my RE: "[a-zA-Z_][a-zA-Z0-9_]+\([^\)]+\)(ed|s|ing)"

And my file used to find these (place in your Lib, and I'm a code-golfer so don't follow my programming style) is here:

import re

search = """__future__          async_generator     hmac                secrets
__hello__           asynchat            html                select
__main__            asyncio             http                selectors
__phello__          asyncore            hyperparser         selenium
_abc                atexit              idle                setuptools
_aix_support        attr                idle_test           shelve
_ast                attrs               idlelib             shlex
_asyncio            audioop             idna                shutil
_bisect             autocomplete        imaplib             sidebar
_blake2             autocomplete_w      imghdr              signal
_bootsubprocess     autoexpand          imp                 site
_bz2                base64              importlib           six
_cffi_backend       bdb                 inspect             smtpd
_codecs             binascii            io                  smtplib
_codecs_cn          bisect              iomenu              sndhdr
_codecs_hk          browser             ipaddress           sniffio
_codecs_iso2022     builtins            itertools           socket
_codecs_jp          bz2                 json                socketserver
_codecs_kr          cProfile            keyword             socks
_codecs_tw          cachetools          lib2to3             sockshandler
_collections        calendar            linecache           sortedcontainers
_collections_abc    calltip             locale              sqlite3
_compat_pickle      calltip_w           logging             squeezer
_compression        certifi             lzma                sre_compile
_contextvars        cffi                macosx              sre_constants
_csv                cgi                 mailbox             sre_parse
_ctypes             cgitb               mailcap             ssl
_ctypes_test        charset_normalizer  mainmenu            stackapi
_curses             chunk               marshal             stackviewer
_curses_panel       cmath               math                stat
_datetime           cmd                 mimetypes           statistics
_decimal            code                mmap                statusbar
_distutils_hack     codecontext         modulefinder        string
_elementtree        codecs              msilib              stringprep
_functools          codeop              msvcrt              struct
_hashlib            collections         multicall           subprocess
_heapq              colorama            multiprocessing     sunau
_imp                colorizer           netrc               symtable
_io                 colorsys            nntplib             sys
_json               compileall          nt                  sysconfig
_locale             compressor          ntpath              tabnanny
_lsprof             concurrent          nturl2path          tarfile
_lzma               config              numbers             telnetlib
_markupbase         config_key          opcode              tempfile
_md5                configdialog        operator            test
_msi                configparser        optparse            textview
_multibytecodec     contextlib          ordlookup           textwrap
_multiprocessing    contextvars         os                  this
_opcode             copy                outcome             threading
_operator           copyreg             outwin              tick
_osx_support        crypt               parenmatch          time
_overlapped         csv                 pathbrowser         timeit
_pickle             ctypes              pathlib             tkinter
_py_abc             curses              pdb                 token
_pydecimal          dataclasses         pefile              tokenize
_pyio               datetime            percolator          tomllib
_queue              dbm                 peutils             tooltip
_random             debugger            pickle              trace
_sha1               debugger_r          pickletools         traceback
_sha256             debugobj            pip                 tracemalloc
_sha3               debugobj_r          pipes               tree
_sha512             decimal             pkg_resources       trio
_signal             delegator           pkgutil             trio_websocket
_sitebuiltins       difflib             platform            tty
_socket             dis                 plistlib            turtle
_sqlite3            distutils           poplib              turtledemo
_sre                doctest             posixpath           types
_ssl                dynoption           pprint              typing
_stat               editor              profile             undo
_statistics         email               pstats              unicodedata
_string             encodings           pty                 unittest
_strptime           ensurepip           py2exe              urllib
_struct             enum                py_compile          urllib3
_symtable           errno               pyclbr              util
_testbuffer         exceptiongroup      pycparser           uu
_testcapi           faulthandler        pydoc               uuid
_testconsole        filecmp             pydoc_data          venv
_testimportmultiple fileinput           pyexpat             warnings
_testinternalcapi   filelist            pyparse             wave
_testmultiphase     fnmatch             pyshell             weakref
_thread             format              query               webbrowser
_threading_local    fractions           queue               window
_tkinter            ftplib              quopri              winreg
_tokenize           functools           random              winsound
_tracemalloc        gc                  re                  wsgiref
_typing             genericpath         redirector          wsproto
_uuid               getopt              replace             xdrlib
_warnings           getpass             reprlib             xkcdget
_weakref            gettext             requests            xml
_weakrefset         glob                rlcompleter         xmlrpc
_winapi             graphlib            rpc                 xxsubtype
_xxsubinterpreters  grep                run                 zipapp
_zoneinfo           gzip                runpy               zipextimporter
abc                 h11                 runscript           zipfile
aifc                hashlib             sched               zipimport
antigravity         heapq               scrolledlist        zlib
argparse            help                search              zoneinfo
array               help_about          searchbase          zoomheight
ast                 history             searchengine        zzdummy""".split("\n")

for i in range(len(search)):
 search[i] = search[i].split()

scopy = []

for i in range(len(search)):
 for j in range(len(search[i])):
  scopy.append(search[i][j])

search = scopy

# This is most certainly not foolproof, but it should pass most cases.
reSearch = "[a-zA-Z_][a-zA-Z0-9_]+\([^\)]+\)(ed|s|ing)"

times = []

for i in search:
 try:
  cont = open(f"{i}.py").read()
 except:
  # It's probably a package
  try:
   cont = open(f"{i}\\__init__.py").read()
  except:
   continue
 times.append(len(re.findall(reSearch, cont)))

print(sum(times))
qqwqqw689 commented 1 year ago

Amazing! I think maybe it is beneficial to let more people understand this.

sunmy2019 commented 1 year ago

I think maybe it is beneficial to let more people understand this.

You don't need to reopen the issue for it.

qqwqqw689 commented 1 year ago

ok