Serhiy Storchaka writes:
> The advantage is that you cannot accidentally turn a function into a
> generator by adding "yield".
Can't mypy catch this?
> Asynchronous functions are more reliable. "async" is mandatory, and if
> you do not await the result of an asynchronous function call you
01.06.22 16:59, Chris Angelico пише:
On Wed, 1 Jun 2022 at 23:55, Serhiy Storchaka wrote:
The advantage is that you cannot accidentally turn a function into a
generator by adding "yield". If the result of the call is ignored (it is
expected to be None), this bug can live a long time. It is a co
On 6/1/2022 9:59 AM, Chris Angelico wrote:
On Wed, 1 Jun 2022 at 23:55, Serhiy Storchaka wrote:
31.05.22 16:21, Chris Angelico пише:
On Tue, 31 May 2022 at 23:00, Aaron L via Python-ideas
wrote:
After getting used to writing async functions, I’ve been wanting use a similar
syntax to declare
On Wed, 1 Jun 2022 at 23:55, Serhiy Storchaka wrote:
>
> 31.05.22 16:21, Chris Angelico пише:
> > On Tue, 31 May 2022 at 23:00, Aaron L via Python-ideas
> > wrote:
> >> After getting used to writing async functions, I’ve been wanting use a
> >> similar syntax to declare generator functions.
> >
31.05.22 16:21, Chris Angelico пише:
On Tue, 31 May 2022 at 23:00, Aaron L via Python-ideas
wrote:
After getting used to writing async functions, I’ve been wanting use a similar
syntax to declare generator functions.
What's the advantage? You can just use normal function syntax to
define the
I don't really disagree with most of what you wrote! And agree that decorators,
specifically, are a pretty good solution within the scope of an individual
package.
But I would quibble with this:
>How fundamental is it that THIS function is a generator, rather than simply
>that
> it returns an
On Wed, 1 Jun 2022 at 03:34, Aaron L via Python-ideas
wrote:
>
> Thanks for your reply.
>
> > What's the advantage?
>
> I brought this up thinking about explicitness and readability. Say you want
> to figure out what this function is doing:
>
>
> def foo() -> t.Iterator[T]:
> [... 300 li
Thanks for your reply.
> What's the advantage?
I brought this up thinking about explicitness and readability. Say you want to
figure out what this function is doing:
def foo() -> t.Iterator[T]:
[... 300 lines of code]
```
Is this a generator function? I'd argue that whether it's a ge
On Tue, 31 May 2022 at 23:00, Aaron L via Python-ideas
wrote:
>
> After getting used to writing async functions, I’ve been wanting use a
> similar syntax to declare generator functions. Something along the lines of
>
> `iter def my_iterator() -> T`
>
> and/or
>
> `gen def my_generator() -> (T, U