I might be alone with this opinion, but I like `typing.Union` in some cases. It feels better to write long multiline cases like this: ``` Alias = Union[ one, two, three, ] ``` Than this: ``` Alias = ( one | two | three ) ``` Some languages even allow to write `| one` to match other indentation: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/discrimina... I would love to keep both! Maybe some others feel the same :) P.S. I originally sent this letter a day ago to Ken Jin only, because I misclicked. Thanks, Ken Jin, for letting me know! ср, 15 дек. 2021 г. в 19:54, Guido van Rossum <guido@python.org>:
TOOWTDI suggests that we should deprecate Optional[T] in favor of T|None, even if not everybody likes the latter.
On Wed, Dec 15, 2021 at 8:44 AM Ethan Smith <ethan@ethanhs.me> wrote:
This seems reasonable, but I have a couple of suggestions/questions:
Would this also apply to subscripting Optional?
I might also suggest we emit a PendingDeprecationWarning on 3.12 when the docs change is made.
As for where to put this timeline, an informational PEP would be fitting, or it could simply go on typing.readthedocs.io
Ethan
On Wed, Dec 15, 2021 at 8:21 AM Paul Moore <p.f.moore@gmail.com> wrote:
+1 from me on this timeline, FWIW. And IMO I agree it would be good to document timelines somewhere. Some sort of "Typing feature timelines" PEP might be the best answer, similar to the release schedule PEPs for Python releases.
Paul
On Wed, 15 Dec 2021 at 15:52, Guido van Rossum <guido@python.org> wrote:
Yeah, sounds about right. Not sure where to put something like that --
nobody will remember that we decided on this timeline by the time 3.15 goes out, unless it's immortalized in a PEP. Maybe we should have a PEP with timelines for various typing features that are now in the core -- PEP 585, PEP 646 and PEP 677 come to mind.
On Wed, Dec 15, 2021 at 7:33 AM Ken Jin <kenjin4096@gmail.com> wrote:
Alright, I propose the following timeline:
1. Python 3.10 added | for Union. 2. Python 3.12 will mark subscripting typing.Union as deprecated in
docs.
3. Python >=3.15 will emit deprecation warning specifically for square-bracket form of typing.Union[]. But keep typing.Union around for runtime simplicity, introspection and runtime typing `isinstance()` uses. By then, 3.9 should be EOL, so library authors shouldn't need to worry supporting that. 4. Python >=3.17 will remove typing.Union[] square bracket usage altogether. Again, we're keeping the typing.Union type itself.
What do y'all think? _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: guido@python.org
-- --Guido van Rossum (python.org/~guido) Pronouns: he/him (why is my pronoun here?) _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: p.f.moore@gmail.com
Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: ethan@ethanhs.me
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...> _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: n.a.sobolev@gmail.com