[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Steven D'Aprano
On Tue, Sep 14, 2021 at 04:50:05PM -0700, Guido van Rossum wrote: > TBH I don't think there is an *actual* problem here. I think it's just > about choosing the right wording for the glossary (which IMO does not have > status as a source of truth anyway). +1 -- Steve

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Guido van Rossum
On Tue, Sep 14, 2021 at 11:44 PM Steven D'Aprano wrote: > On Tue, Sep 14, 2021 at 09:38:38PM -0700, Guido van Rossum wrote: > > > > I don't know what I would call an object that only has __next__, > > > apart from "broken" :-( > > > > > > > It's still an iterator, since it duck-types in most

[Python-Dev] Re: python3.10rc2 compilation on android/termux/clang12.0.1 fails

2021-09-15 Thread Guido van Rossum
Sounds to me as if the first warning is somewhat legit (you can probably ignore it). The second seems to be a limitation of your platform -- that code is only compiled if HAS_GETRANDOM is set by the configure script, so apparently ./configure determined that it exists, but the compiler thinks it

[Python-Dev] python3.10rc2 compilation on android/termux/clang12.0.1 fails

2021-09-15 Thread Sandeep Gupta
I am trying to compile Python3.10rc2 on rather unusual platform (termux on android). The gcc version is listed below: ~ $ g++ -v clang version 12.0.1 Target: aarch64-unknown-linux-android24 Thread model: posix InstalledDir: /data/data/com.termux/files/usr/bin I get following warnings and errors:

[Python-Dev] Re: python3.10rc2 compilation on android/termux/clang12.0.1 fails

2021-09-15 Thread Jelle Zijlstra
Did previous versions of Python compile successfully? The RC phase wouldn't be the right time to add support for a new platform. El mié, 15 sept 2021 a las 10:15, Sandeep Gupta () escribió: > I am trying to compile Python3.10rc2 on rather unusual platform (termux on > android). The > gcc version

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Guido van Rossum
On Wed, Sep 15, 2021 at 3:54 PM Ethan Furman wrote: > Guido: > > It's still an iterator, since it duck-types in most cases where an > iterator > > is required (notably "for", which is the primary use case for the > iteration > > protocols -- it's in the first sentence of PEP 234's abstract).

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Ethan Furman
Guido: > It's still an iterator, since it duck-types in most cases where an iterator > is required (notably "for", which is the primary use case for the iteration > protocols -- it's in the first sentence of PEP 234's abstract). D'Aprano: > I don't think it duck-types as an iterator. Here's an

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Terry Reedy
On 9/15/2021 12:33 AM, Guido van Rossum wrote: On Tue, Sep 14, 2021 at 9:03 PM Steven D'Aprano > wrote: On Tue, Sep 14, 2021 at 12:33:32PM -0700, Guido van Rossum wrote: > My view of this is: > > A. It's not an iterator if it doesn't define

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Chris Barker via Python-Dev
Note: I am all for not enforcing anything here -- let's keep duck typing alive! If static type checkers want to be more pedantic, they can be -- that's kinda what they are for :-) But the OP wrote: """ "[i]terators are required to have an __iter__()

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Steven D'Aprano
On Wed, Sep 15, 2021 at 08:57:58AM -0700, Guido van Rossum wrote: [...] > Yes, we all understand that. The reason I invoked "duck typing" is that as > long as you don't use the iterator in a situation where iter() is called on > it, it works fine. Just like a class with a readline() method works

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Steven D'Aprano
On Wed, Sep 15, 2021 at 04:01:31PM -0700, Guido van Rossum wrote: > Steven's class A is the kind of class a custom sequence might return from > its __iter__ method. E.g. > > class S: > def __iter__(self): > return A() Correct, where A itself has a `__next__` method but no `__iter__`

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Steven D'Aprano
On Tue, Sep 14, 2021 at 09:38:38PM -0700, Guido van Rossum wrote: > > I don't know what I would call an object that only has __next__, > > apart from "broken" :-( > > > > It's still an iterator, since it duck-types in most cases where an iterator > is required (notably "for", which is the