[Python-ideas] Re: Create a @deprecated decorator (annotation)

2021-08-15 Thread Cameron Simpson
On 29Jul2021 15:58, Paul Moore wrote: >On Thu, 29 Jul 2021 at 15:39, Leonardo Freua > wrote: >> Would it be interesting to create a @deprecated decorator to avoid >> adding warnings.warn("deprecation message", DeprecationWarning, >> stacklevel=2) in methods body? > >I don't see the value

[Python-ideas] Re: PEP idea

2021-08-15 Thread Guido van Rossum
That's proposed in PEP 645 (https://www.python.org/dev/peps/pep-0645/). Personally I think it's not necessary, we should just write MyType | None. (Yes, this is directly from TypeScript.) On Sun, Aug 15, 2021 at 6:10 AM Will Bradley wrote: > Hi all, > > As of 3.10 (PEP 604) we've gotten

[Python-ideas] Re: Notation for subscripts.

2021-08-15 Thread Guido van Rossum
Have you seen PEP 637? IIRC it has discussions on a[] and a[*x]. Note that it was rejected, but the idea of a[*x] is being resurrected for PEP 646. On Fri, Aug 13, 2021 at 5:43 AM Matsuoka Takuo wrote: > Dear Developers, > > Given a subscriptable object s, the intended rule for the notation for

[Python-ideas] Re: Create a @deprecated decorator (annotation)

2021-08-15 Thread Marco Sulla
@Deprecated is used in Java and I find it very easy to use. Remember you can also use parameters in decorators. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: copy-paste code snippets to the python console

2021-08-15 Thread Marco Sulla
You can use the Jupiter console: https://jupyter.org/ On Fri, 11 Jun 2021 at 15:13, Raymond Bisdorff wrote: > > Dear Python developers, > > It would be helpful, if the following issue with copy-pasting python > code-snippets into the standard shell console, could be investigated and > corrected.

[Python-ideas] Re: PEP idea

2021-08-15 Thread Thomas Grainger
You can use `T | None` ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at

[Python-ideas] Re: PEP idea

2021-08-15 Thread Thomas Grainger
Any has the same number of characters as All ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at

[Python-ideas] Re: PEP idea

2021-08-15 Thread James Oldfield
Surely there already is a built in for that, not quite as short as “All” but shorter than “typing.Any”: “object”. Avoids keyword pollution, already has clear meaning. And it works with isinstance! :-) Is there something I’m missing? I never saw the point of typing.Any. From: Abdulla Al

[Python-ideas] Re: PEP idea

2021-08-15 Thread Abdulla Al Kathiri
+1 I like it, anything to get rid of Optional[type] is good. If we can replace Callable[[type1], type2] with (type1) -> type2 and typing.Any with just soft keyword “All”, type annotations will be fun! Sent from my iPhone > On 15 Aug 2021, at 8:41 PM, Joren Hammudoglu wrote: > >  > See

[Python-ideas] Re: Pattern matching in python function headers

2021-08-15 Thread Abdulla Al Kathiri
You have a point, but the mathematical approach of Haskell of different function cases is quite readable and straight forward. I only coded a little in Haskell and I know how to read it. I am not sure if you would consider Rust a functional language but they have pattern matching for function

[Python-ideas] Re: PEP idea

2021-08-15 Thread Joren Hammudoglu
See https://www.python.org/dev/peps/pep-0645/ ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at

[Python-ideas] Re: Notation for subscripts.

2021-08-15 Thread Matsuoka Takuo
Dear Steve, Thank you for your thoughts. To be precise, the sequence of letters "*(1,2)" is not actually a "starred expression" in the sense of the Python Language, but e.g., "*(1,2), " is. (A comma is trailing.) Please check the definitions here:

[Python-ideas] PEP idea

2021-08-15 Thread Will Bradley
Hi all, As of 3.10 (PEP 604) we've gotten syntactical support for a common type operation— namely, typing.Union[Type1, Type2] can now be written as Type1 | Type2 . This is achieved via overriding the __or__ method. I propose the ? symbol as sugar for typing.Optional, so that