[Python-Dev] PEP 484 proposal: don't default to Optional if argument default is None
Guido van Rossum
guido at python.org
Tue May 9 23:31:52 EDT 2017
More information about the Python-Dev mailing list
Tue May 9 23:31:52 EDT 2017
- Previous message (by thread): [Python-Dev] PEP 484 proposal: don't default to Optional if argument default is None
- Next message (by thread): [Python-Dev] PEP 484 proposal: don't default to Optional if argument default is None
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, May 9, 2017 at 7:37 PM, Nick Coghlan <ncoghlan at gmail.com> wrote: > On 10 May 2017 at 08:51, Brett Cannon <brett at python.org> wrote: > > On Tue, 9 May 2017 at 11:11 Carl Meyer <carl at oddbird.net> wrote: > >> It might be nice to have a less verbose syntax for Optional, but that > >> can be a separate discussion. > > > > You should be able to do that today with `from typing import Optional as > Eh` > > or whatever your preferred optional/maybe name is. :) > > While "from typing import Optional as Opt" can indeed help, perhaps > PEP 505 should be updated to discuss this point in addition to the > current proposals for None-aware binary operators? > > If it included a ? prefix operator as a shorthand for > "typing.Optional[<expr>]", that would shorten affected declarations > back to: > > def handle_employee(e: ?Employee = None) -> None: ... > I really don't want to go there. And this idea should definitely not be a condition for removing the existing PEP 484 feature. Whatever gets done syntax-wise won't affect anyone who needs any kind of backward compatibility anyways, and that's very important for practical adoption of PEP 484. -- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20170509/2eb996fe/attachment.html>
- Previous message (by thread): [Python-Dev] PEP 484 proposal: don't default to Optional if argument default is None
- Next message (by thread): [Python-Dev] PEP 484 proposal: don't default to Optional if argument default is None
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list