A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-May/147908.html below:

[Python-Dev] PEP 484 proposal: don't default to Optional if argument default is None

[Python-Dev] PEP 484 proposal: don't default to Optional if argument default is None [Python-Dev] PEP 484 proposal: don't default to Optional if argument default is NoneGuido van Rossum guido at python.org
Tue May 9 13:28:41 EDT 2017
There's a proposal to change one detail of PEP 484. It currently says:

An optional type is also automatically assumed when the default value is
None, for example::

  def handle_employee(e: Employee = None): ...

This is equivalent to::

  def handle_employee(e: Optional[Employee] = None) -> None: ...


Now that we've got some experience actually using Optional with mypy
(originally mypy ignored Optional), we're beginning to think that this was
a bad idea. There's more discussion at
https://github.com/python/typing/issues/275 and an implementation of the
change (using a command-line flag) in
https://github.com/python/mypy/pull/3248.

Thoughts? Some function declarations will become a bit more verbose, but we
gain clarity (many users of annotations don't seem to be familiar with this
feature) and consistency (since this rule doesn't apply to variable
declarations and class attribute declarations).

-- 
--Guido van Rossum (python.org/~guido <http://python.org/%7Eguido>)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170509/61e7609d/attachment.html>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4