Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.7k
PEP 484: Do not require type checkers to treat a None default specially#689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Following discussion inpython/typing#275, there is a consensus that it is better to require optional types to be made explicit. This PR changes the wording of PEP 484 to allow, but not require, type checkers to treat a None default as implicitly making an argument Optional.
pep-0484.txt Outdated
| def handle_employee(e: Optional[Employee] = None) -> None: ... | ||
| Type checkers may also require the optional type to be made explicit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Hm, maybe I was too wishy-washy. Pondering this again I think the language in PEP 484 should acknowledge that PEP 484 used to automatically inferOptional[] based on an= None default, and that type-checkers historically did it that way, but that we changed our mind and that in the future the PEP will mandate that thisnot be done. What type checkerscurrently do is then merely dependent on where the type checker is in its migration to the future behavior.
Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@JelleZijlstra Any response to that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I forgot about this one, will get back to it soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
How is this new wording?
gvanrossum commentedJul 10, 2018
Thanks, looks good! @dark@vlasovskikh@rchen152@markshannon Please note this update to PEP 484. |
The definition of AnyStr as given makes sense only in Python 3, as observed by@srittau. To prevent confusion, this PR changes the definition to use Text instead of str.I also changed the two places where AnyStr was defined as an example, and made a few other related adjustments:- Remove mention of None as modifying the type, which is not true as ofpython#689.- Move Text up in the list of convenience definition because we now need it for the definition of AnyStr.- Modify definition of Optional to use `None` instead of `type(None)`, because the latter is not a valid static type.
The definition of AnyStr as given makes sense only in Python 3, as observed by@srittau. To prevent confusion, this PR changes the definition to use Text instead of str.I also changed the two places where AnyStr was defined as an example, and made a few other related adjustments:- Remove mention of None as modifying the type, which is not true as of#689.- Move Text up in the list of convenience definition because we now need it for the definition of AnyStr.- Modify definition of Optional to use `None` instead of `type(None)`, because the latter is not a valid static type.
"Implicit-optional" mode is on by default, but that default is intended to change in the indefinite future (python/peps#689,python/typing#275). Go ahead and change to the future explicit use of Optional.
takluyver commentedMar 28, 2020
PEP-483 still mentions this shorthand:
This isn't the spec, but it's still a contradictory bit of information which sent me down a rabbit hole to here. |
This shorthand is no longer recommended - seepython#689 which changed it in PEP 484.
takluyver commentedMar 28, 2020
(Made PR#1345 to remove that mention) |
This shorthand is no longer recommended - see#689 which changed it in PEP 484.
Disable implicit optional checks in mypy.ini- [PR to PEP that changed the behavior](python/peps#689)- [mypy option](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-optional)
This shorthand is no longer recommended - seepython#689 which changed it in PEP 484.
* iostream: check that stream is open before trying to read (tornadoweb#2670)* curl_httpclient: fix disabled decompress_responseby setting None (NULL) instead of "none" for ENCODINGreported by Andrey Oparin <andrey@edsd.com>* tests: run test_gzip for curl_httpclient alsomove simple_httpclient test_gzip to the shared httpclient tests,to test the decompress_response option for curl_httpclient as well* mypy: Enable no_implicit_optional"Implicit-optional" mode is on by default, but that default is intended to change in the indefinite future (python/peps#689,python/typing#275). Go ahead and change to the future explicit use of Optional.* gen.with_timeout: Don't log CancelledError after timeoutSee also: commita237a99* Fix ReST syntax* locks: Remove redundant CancelledError handlingCancelledError is now always considered "quiet" (andconcurrent.futures.CancelledError is no longer the same asasyncio.CancelledError).* ci: Re-enable nightly pythonFixestornadoweb#2677* gen: Clean up docs for with_timeoutMark CancelledError change as 6.0.3* *: Modernize IO error handlingWhere possible, replace use of errno with the exception hierarchyavailable since python 3.3. Remove explicit handling of EINTR whichhas been automatic since python 3.5* netutil: Ignore EADDRNOTAVAIL when binding to localhost ipv6This happens in docker with default configurations and is generallyharmless.Fixestornadoweb#2274* test: Skip test_source_port_fail when running as rootRoot is always allowed to bind to low port numbers, so we can'tsimulate failure in this case. This is the last remaining failure whenrunning tests in docker.* docs: Add notice about WindowsSelectorEventLoop on py38Fixestornadoweb#2608* Bump version of twisted to pick up security fix* Release notes for 6.0.3* SSLIOStream: Handle CertificateErrors like other errorsFixes:tornadoweb#2689* Update database backend reference* Strip documentation about removed argument* Mark Template autoescape kwarg as Optional* httputil: cache header normalization with @lru_cache instead of hand-rollingTornado is now py3-only so @lru_cache is always available.Performance is about the same. Benchmark below. Python 3.7 on Linux.before, cached: 0.9121252089971676before, uncached: 13.358482279989403after, cached: 0.9175888689933345after, uncached: 11.085199063003529```pyfrom time import perf_counternames = [f'sOMe-RanDOM-hEAdeR-{i}' for i in range(1000)]from tornado.httputil import _normalize_headerstart = perf_counter()for i in range(10000): # _normalize_header.cache_clear() for name in names: _normalize_header(name)print(perf_counter() - start)from tornado.httputil import _NormalizedHeaderCachestart = perf_counter()_normalized_headers = _NormalizedHeaderCache(1000)for i in range(10000): # _normalized_headers = _NormalizedHeaderCache(1000) for name in names: _normalized_headers[name]print(perf_counter() - start)```* httputil: use compiled re patternsThis is slightly faster than using the builtin cache, e.g.:With benchmark below (Python 3.7, Linux):before: 0.7284867879934609after: 0.2657967659761198```pyimport refrom time import perf_counterline = 'HTTP/1.1'_http_version_re = re.compile(r"^HTTP/1\.[0-9]$")start = perf_counter()for i in range(1000000): _http_version_re.match(line)print(perf_counter() - start)start = perf_counter()for i in range(1000000): re.match(r"^HTTP/1\.[0-9]$", line)print(perf_counter() - start)```* test: Disable TLS 1.3 in one testThis test started failing on windows CI with an upgrade to python3.7.4 (which bundles a newer version of openssl). Disable tls 1.3 fornow.Possibly related totornadoweb#2536* spelling corrections* maintainance -> maintenance* recieving -> receiving* tests: replace remaining assertEquals() with assertEqual()assertEquals() is deprecated, and python3.7/pytest can warn about it* httputil.parse_body_arguments: allow incomplete url-escapingsupport x-www-form-urlencoded body with values consisting ofencoded bytes which are not url-encoded into ascii(it seems other web frameworks often support this)add bytes qs support to escape.parse_qs_bytes,leave str qs support for backwards compatibility* Clear fewer headers on 1xx/204/304 responsesThis function is called on more than just 304 responses; it’simportant to permit the Allow header on 204 responses. Also, therelevant RFCs have changed significantly.Fixestornadoweb#2726.Signed-off-by: Anders Kaseorg <andersk@mit.edu>* Fix extra data sending at HEAD response with Transfer-Encoding: Chunked* Omit Transfer-Encoding header for HEAD response* Add test for unescaping with groups* Fix unescaping of regex routesPreviously, only the part before the first '(' would be correctlyunescaped.* Use HTTPS link for tornado website.* Simplify chained comparison.* build(deps): bump twisted from 19.2.1 to 19.7.0 in /maintBumps [twisted](https://github.com/twisted/twisted) from 19.2.1 to 19.7.0.- [Release notes](https://github.com/twisted/twisted/releases)- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)- [Commits](twisted/twisted@twisted-19.2.1...twisted-19.7.0)Signed-off-by: dependabot[bot] <support@github.com>* Dead link handlingAdded an extra set for handling dead links, and reporting.One consequence of this is that using this script will "work" offline, but will report that some all the links were not fetched.* ci: Pin version of blackA new release of black changed the way some of our files are formatted,so use a fixed version in CI.* demos: Fix lint in webspider demoUpdatestornadoweb#2765* build: Revamp test/CI configurationReduce tox matrix to one env per python version, with two extra buildsfor lint and docs. Delegate to tox from travis-ci.Add 3.8 to testing. Simplify by dropping coverage reporting and"no-deps" test runs.* process: correct docs of fork_processes exit behaviorfixestornadoweb#2771* Remove legacy Python support in speedups.c* ci: Don't run full test suite on python 3.5.2* web: Update hashing algorithm in StaticFileHandler (tornadoweb#2778)Addressestornadoweb#2776.* build: Run docs and lint on py38This requires moving some noqa comments due to 3.8's changes to theast module.* lint: Upgrade to new version of black* lint: Use newer mypyThis required some minor code changes, mainly some adjustments in tests(which are now analyzed more thoroughly in spite of being mostlyunannotated), and some changes to placement of type:ignore comments.* use bcrypt's checkpw instead of ==* Fix case of JavaScript, GitHub and CSS.* Fix syntax error in nested routing example* test: Add gitattributes for test data filesThis ensures that the tests pass on Windows regardless of the user's gitCRLF settings.* test: Use selector event loop on windows.This gets most of the tests working again on windows with py38.* test: Add some more skips on windowsAlternate resolvers behave differently on this platform for unknownreasons.* test: Add hasattr check for SIGCHLDThis name is not present on all platforms* testing: Add level argument to ExpectLogThis makes it possible for tests to be a little more precise, and alsomakes them less dependent on exactly how the test is run (runtests.pysets the logging level to info, but when running tests directly froman editor it may use the default of warnings-only).CI only runs the tests with runtests.py, so this might regress, but I'mnot building anything to prevent that yet (options include running thetests differently in CI or making ExpectLog always use a fixed logconfiguration instead of picking up the current one)* ci: Add python 3.8 to windows CI* asyncio: AnyThreadEventLoopPolicy should always use selectors on windows* iostream: resolve reads that may be completed while closingfixes issue that a read may fail with StreamClosedErrorif stream is closed mid-read* avoid premature _check_closed in _start_read_start_read can resolve with _try_inline_read, which can succeed even if the stream has been closedif the buffer has been populated by a prior readpreserve the fix for asserts being hit when dealing with closed sockets* catch UnsatisfiableReadError in close* iostream: Add tests for behavior around close with read_untilUpdatestornadoweb#2719* iostream: Expand comments around recent subtle changes* Fix Google OAuth example (from 6.0 OAuth2Mixin->authorize_redirect is an ordinary synchronous function)* Add Python 3.8 clasifier to setup.py* Standardize type documentation for HTTPRequest init* travis-ci.com doesn't like it when you have matrix and jobs.org still allows this for some reason* Master branch release notes for version 6.0.4* maint: Bump bleach version for a security fix* iostream: Update commentUpdate comment fromtornadoweb#2690 about ssl module exceptions.* Added default User-Agent to the simple http client if not provided.The User-Agent format is "Tornado\{Tornado_Version}".If self.request.user_agent isn't set and self.request.headers hasno User-Agent in it's keys the default User-Agent is added.Fixes:tornadoweb#2702* Revert "docs: Use python 3.7 via conda for readthedocs builds"This reverts commite7e31e5.We were using conda to get access to python 3.7 before rtd supportedit in their regular builds, but this led to problems pinning aspecific version of sphinx. Seereadthedocs/readthedocs.org#6870* fix new E741 detected cases* fix typos* revert genericize change* stop ping_callback* fix types for max_age_days and expires_days parameters* test: Add a sleep to deflake a testNot sure why this has recently started happening in some environments,but killing a process too soon causes the wrong exit status in somepython builds on macOS.* ci: Drop tox-venvIts README says it is mostly obsolete due to improvements invirtualenv. Using it appears to cause problems related topypa/setuptools#1934 because virtualenvinstalls the wheel package by default but venv doesn't.* ci: Allow failures on nightly python due to cffi incompatibility* template: Clarify docs on escapingOriginally fromtornadoweb#2831, which went to the wrong branch.* test: Use default timeouts in sigchild testThe 1s timeout used here has become flaky with the introduction of asleep (before the timeout even starts).* auth: Fix example codeContinuation oftornadoweb#2811The oauth2 version of authorize_redirect is no longer a coroutine, sodon't use await in example code. The oauth1 version is still acoroutine, but one twitter example was incorrectly calling it withyield instead of await.* platform: Remove tornado.platform.auto.set_close_execThis function is obsolete: Since python 3.4, file descriptors createdby python are non-inheritable by default (and in the event you createa file descriptor another way, a standard function os.set_inheritableis available).The windows implementation of this function was also apparentlybroken, but this went unnoticed because the default behavior onwindows is for file descriptors to be non-inheritable.Fixestornadoweb#2867* iostream,platform: Remove _set_nonblocking functionThis functionality is now provided directly in the `os` module.* test: Use larger time values in testing_testThis test was flaky on appveyor. Also expand comments about whatexactly the test is doing.* Remove text about callback (removed) in run_on_executor* curl_httpclient: set CURLOPT_PROXY to NULL if pycurl supports itThis restores curl's default behaviour: use environment variables.This option was set to "" to disable proxy in905a215 but curl uses environmentvariables by default.* httpclient_test: Improve error reportingWithout this try/finally, if this test ever fails, errors can bereported in a confusing way.* iostream_test: Improve cleanupClosing the file descriptor without removing the corresponding handleris technically incorrect, although the default IOLoops don't have aproblem with it.* test: Add missing level to ExpectLog call* asyncio: Improve support Python 3.8 on WindowsThis commit removes the need for applications to work around thebackwards-incompatible change to the default event loop. Instead,Tornado will detect the use of the windows proactor event loop andstart a selector event loop in a separate thread.Closestornadoweb#2804* asyncio: Rework AddThreadSelectorEventLoopRunning a whole event loop on the other thread leads to trickysynchronization problems. Instead, keep as much as possible on themain thread, and call out to a second thread only for the blockingselect system call itself.* test: Add an option to disable assertion that logs are emptyUse this on windows due to a log spam issue in asyncio.* asyncio: Refactor selector to callbacks instead of coroutineRestarting the event loop to "cleanly" shut down a coroutine introducesother problems (mainly manifesting as errors logged while runningtornado.test.gen_test). Replace the coroutine with a pair of callbacksso we don't need to do anything special to shut down without loggingwarnings.* docs: Pin version of sphinxcontrib-asyncioThe just-released version 0.3.0 is incompatible with our older pinnedversion of sphinx.* docs: Pin version of sphinxcontrib-asyncioThe just-released version 0.3.0 is incompatible with our older pinnedversion of sphinx.* Added arm64 jobs for Travis-CI* CLN : Remove utf-8 coding cookies in source filesOn Python 3, utf-8 is the default python source code encoding. so, thecoding cookies on files that specify utf-8 are not needed anymore.modified: tornado/_locale_data.pymodified: tornado/locale.pymodified: tornado/test/curl_httpclient_test.pymodified: tornado/test/httpclient_test.pymodified: tornado/test/httputil_test.pymodified: tornado/test/options_test.pymodified: tornado/test/util_test.py* Allow non-yielding functions in `tornado.gen.coroutine`'s type hint (tornadoweb#2909)`@gen.coroutine` deco allows non-yielding functions, so I reflected that in the type hint.Requires usage of `@typing.overload` due topython/mypy#9435* Update super usage (tornadoweb#2912)On Python 3, super does not need to be called with arguments where as onPython 2, super needs to be called with a class object and an instance.This commit updates the super usage using automated regex-based searchand replace. After the automated changes were made, each change wasindividually checked before committing.* Update links on home page* Updated http links to the https versions when possible.* Updated links to Google Groups to match their new URL format.* Updated links to other projects to match their new locations.* And finally, updated link to FriendFeed to go to the Wikipedia page, because friendfeed.com is just a redirect to facebook.com now :-( :-(* Modified ".travis.yml" to test it's own built wheelSigned-off-by: odidev <odidev@puresoftware.com>* tests: httpclient may turn all methods into GET for 303 redirect* websocket_test: test websocket_connect redirect raises exceptioninstead of "uncaught exception" and then test timeout* websocket: set follow_redirects to Falseto prevent silent failure when the websocket client gets a 3xxredirect response, because it does not currently support redirectsPartial fix for issuetornadoweb#2405* simple_httpclient: after 303 redirect, turn all methods into GETnot just POST (but still not HEAD)following the behavior of libcurl > 7.70* httpclient_test: add test for connect_timeout=0 request_timeout=0* simple_httpclient: handle connect_timeout or request_timeout of 0Using a connect_timeout or request_timeout of 0 was effectivelyinvalid for simple_httpclient: it would skip the actual requestentirely (because the bulk of the logic was inside "if timeout:").This was not checked for or raised as an error, it just behavedunexpectedly.Change simple_httpclient to always assert these timeouts are not Noneand to support the 0 value similar to curl (where request_timeout=0means no timeout, and connect_timeout=0 means curl default 300 secondswhich is very very long for a tcp connection).* httpclient: document connect_timeout/request_timeout 0 valuenot exactly true for curl_httpclient (libcurl uses a connect_timeoutof 300 seconds if no connect timeout is set) but close enough* test: update Travis-CI matrix pypy version to 3.6-7.3.1* httpclient_test: new test for invalid gzip Content-Encodingthis caused an infinite loop in simple_httpclient* http: fix infinite loop hang with invalid gzip data* test: Refactor CI configuration- Add osx and windows builds on travis- Stop running -full test suites on every python version on arm64- Use cibuildwheel to build for all python versions in one job per platform- Bring a single test configuration and linters up to a first "quick" stage before starting the whole matrix- Push the resulting wheels (and sdist) to pypi on tag builds* Add release notes for 6.1, bump version to 6.1b1* ci: Switch from testpypi to real pypi* Add deprecation notice for Python 3.5* Update how to register application with Google* Fix await vs yield in the example* gen: Expliclty track contextvars, fixing contextvars.resetThe asyncio event loop provides enough contextvars support out of thebox for basic contextvars functionality to work in tornado coroutines,but not `contextvars.reset`. Prior to this change, each yield createda new "level" of context, when an entire coroutine should be on thesame level. This is necessary for the reset method to work.Fixestornadoweb#2731* test: Add a timeout to SyncHTTPClient test* asyncio: Manage our own thread instead of an executorPython 3.9 changed the behavior of ThreadPoolExecutor at interpretershutdown (after the already-tricky import-order issues aroundatexit hooks). Avoid these issues by managing the thread by hand.* ci,setup: Add python 3.9 to tox, cibuildwheel and setup.py* Bump version to 6.1b2* Set version to 6.1 final* ci: Work around outdated windows root certificates* Bump main branch to 6.2.dev1* Remove appveyor configs* Drop support for python 3.5* iostream: Add platform assertion for mypyWithout this mypy would fail when run on windows.* maint: Prune requirements listsRemove dependencies that are rarely used outside of tox. The mainmotivation is to give dependabot less to worry about when an indirectdependency has a security vulnerability.* *: Update black to newest version* Update mypy to latest version* docs: Upgrade to latest version of sphinxThis version attempts to resolve types found in type annotations,but in many cases it can't find them so silence a bunch of warnings.(Looks like deferred annotation processing will make this better butwe won't be able to use that until we drop Python 3.6)* docs: Pin specific versions of requirements* docs: Stop using autodoc for t.p.twistedThis way we don't have to install twisted into the docs buildenvironment. Add some more detail while I'm here.* platform: Deprecate twisted and cares resolversThese were most interesting when the default resolver blockedthe main thread. Now that the default is to use a thread pool,there is little if any demand for alternative resolvers just toavoid threads.* Issuetornadoweb#2954: prevent logging error messages for not existing translation filesEvery not existing translation file for the existing locales logged an error message:Cannot load translation for 'ps': [Errno 2] No such file or directory: '/usr/share/locale/ps/LC_MESSAGES/foo.mo'* WaitIterator: don't re-use _running_futureWhen used with asyncio.Future, WaitIterator may skip indices in somecases. This is caused by multiple _return_result calls after another,without having the chain_future call finish in between. This is fixedhere by not hanging on to the _running_future anymore, which forcessubsequent _return_result calls to add to _finished, instead of causingthe previous result to be silently dropped.Fixestornadoweb#2034* Fix return type of _return_result* docs: fix simple typo, authentiate -> authenticateThere is a small typo in tornado/netutil.py.Should read `authenticate` rather than `authentiate`.* Avoid 2GB read limitation on SSLIOStream* Remove trailing whitespace* locale: Format with black* wsgi: Update docstring example for python 3Fixestornadoweb#2960* Remove WebSocketHandler.stream.It was no longer used and always set to None.* Add 'address' keyword control binded addresstornadoweb#2969* format code according to result of flake8 check* Add comment explaining workaround* change comment* should use python3 unicode in 'blog' demotornadoweb#2977* leave previous versionchanged* leave previous versionchanged* write_message method of WebSocketClientConnection now accepts dict as input* write_message method of WebSocketClientConnection now accepts dict as input* Uppercase A in Any* BaseIOStream.write(): support typed memoryviewMaking sure that ``len(data) == data.nbytes`` by castingmemoryviews to bytes.* Allowed set max_body_size to 0* fix line too long* fix E127* what* But this is not beautiful* Is this okay* build(deps): bump jinja2 from 2.11.2 to 2.11.3 in /docsBumps [jinja2](https://github.com/pallets/jinja) from 2.11.2 to 2.11.3.- [Release notes](https://github.com/pallets/jinja/releases)- [Changelog](https://github.com/pallets/jinja/blob/master/CHANGES.rst)- [Commits](pallets/jinja@2.11.2...2.11.3)Signed-off-by: dependabot[bot] <support@github.com>* build(deps): bump pygments from 2.7.2 to 2.7.4 in /docsBumps [pygments](https://github.com/pygments/pygments) from 2.7.2 to 2.7.4.- [Release notes](https://github.com/pygments/pygments/releases)- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)- [Commits](pygments/pygments@2.7.2...2.7.4)Signed-off-by: dependabot[bot] <support@github.com>Co-authored-by: Ben Darnell <ben@bendarnell.com>Co-authored-by: Zachary Sailer <zachsailer@gmail.com>Co-authored-by: Pierce Lopez <pierce.lopez@gmail.com>Co-authored-by: Robin Roth <robin@rroth.de>Co-authored-by: Petr Viktorin <encukou@gmail.com>Co-authored-by: Martijn van Oosterhout <oosterhout@fox-it.com>Co-authored-by: Michael V. DePalatis <mike@depalatis.net>Co-authored-by: Remi Rampin <r@remirampin.com>Co-authored-by: Ran Benita <ran@unusedvar.com>Co-authored-by: Semen Zhydenko <simeon.zhidenko@gmail.com>Co-authored-by: Anders Kaseorg <andersk@mit.edu>Co-authored-by: Bulat Khasanov <afti@yandex.ru>Co-authored-by: supakeen <cmdr@supakeen.com>Co-authored-by: John Bampton <jbampton@users.noreply.github.com>Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Co-authored-by: Jeff van Santen <jeffreyavansanten@gmail.com>Co-authored-by: Bruno P. Kinoshita <kinow@users.noreply.github.com>Co-authored-by: Gareth T <garetht@users.noreply.github.com>Co-authored-by: Min RK <benjaminrk@gmail.com>Co-authored-by: bn0ir <gblacknoir@gmail.com>Co-authored-by: James Bourbeau <jrbourbeau@gmail.com>Co-authored-by: Recursing <buonanno.lorenzo@gmail.com>Co-authored-by: Flavio Garcia <piraz@candango.org>Co-authored-by: Ben Darnell <ben@cockroachlabs.com>Co-authored-by: marc <Marc>Co-authored-by: agnewee <agnewee@gmail.com>Co-authored-by: Jeff Hunter <jeff@jeffhunter.me>Co-authored-by: 依云 <lilydjwg@gmail.com>Co-authored-by: odidev <odidev@puresoftware.com>Co-authored-by: Sai Rahul Poruri <rporuri@enthought.com>Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>Co-authored-by: Amit Patel <amitp@cs.stanford.edu>Co-authored-by: Debby <debby@glance.net>Co-authored-by: = <=>Co-authored-by: Eugene Toder <eltoder@users.noreply.github.com>Co-authored-by: Florian Best <best@univention.de>Co-authored-by: Alexander Clausen <alex@gc-web.de>Co-authored-by: Tim Gates <tim.gates@iress.com>Co-authored-by: bfis <b.fis@cern.ch>Co-authored-by: Eugene Toder <eltoder@gmail.com>Co-authored-by: youguanxinqing <youguanxinqing@qq.com>Co-authored-by: kriskros341 <krzysztofczuba884@gmail.com>Co-authored-by: Mads R. B. Kristensen <madsbk@gmail.com>Co-authored-by: Sakuya <dl@pbstu.com>
Following discussion inpython/typing#275, there is a consensus that it is better to require optional types to be made explicit. This PR changes the wording of PEP 484 to allow, but not require, type checkers to treat a None default as implicitly making an argument Optional.