Consider deprecating iter
See original GitHub issueI think iter
should probably not be part of the library’s public API surface.
Strings and arrays are already iterables. A deprecation notice could warn users when an object is passed to iter
, informing them that they should use entries instead.
Internally a function called iter could continue to be used with the same basic responsibility of making an iterator out of an iterable.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Reasoning for stream::iter deprecation? · Issue #576 - GitHub
This is interesting, I need to think about some of my impls that currently expect errors from the stream. Such as timeouts. Without...
Read more >Deprecate "old-style iteration protocol"? - Ideas
My proposal is to deprecate this fallback mechanism, emit a DeprecationWarning at first and eventually raise a TypeError unless __iter__ is ...
Read more >std::iterator is deprecated: Why, What It Was, and What to Use ...
What exactly has been deprecated, and what is the consequence on our code right now? This is what we discuss here.
Read more >How to solve: WARNING : deprecated key derivation used ...
I am using OpenSSL version 1.1.1b (26 Feb 2019) to encrypt/decrypt files. Everything is working fine but I am getting a Warning I...
Read more >Built in iter() function and for statement - python - Stack Overflow
We exit from loop once IndexError raises. To have the backward compatibility getitem method is still not deprecated (Till Python version 3.8.5).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was already happy removing “entries” from iter. That was super confusing: “What if I want the entries of an object but this is already iterable ?”
About the other changes, I had to review carefully the specs (and your comments @conartist6) to form myself an opinion. What is important IMO was to be able to work with any object you could pass to “for … of” and to return an object you can pass to the “for…of”. In the specs it states that “for …of” works with object implementing the iterable protocol.
This is implemented by generator objects built-in objects like arrays, strings, etc. , and custom object with @@iterator. So what is left out?
So I am positive with these changes and the PR.
Previous implementation was based on a few misconceptions of its author: myself 🤣