- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
➜
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | veky |
|---|---|
| Recipients | Zero, docs@python, r.david.murray, rhettinger, terry.reedy, veky |
| Date | 2017-07-17.15:47:49 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1500306469.28.0.0276437456661.issue18558@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
|---|
Yes, the mapping/sequence distinction was (at least declaratively) the reason the ABCs were introduced, but that isn't an obstacle here: whether a mapping or a sequence, it _is_ iterable, right?
---
In case anybody is interested, here's how I came to this problem: at a programming competition, I set a problem where contestants had to write some function, and I declared that "the function must work for arbitrary iterable (with some properties that currently don't matter)".
Then a big discussion ensued, with a big group of people thinking that classes with __getitem__ but no __iter__ don't quality (giving collections.abc.Iterable as an argument), and another big group of people thinking they do (giving EAFP as an argument: "look, I tried iterating, and succeeded").
Of course, it's an incredibly technical detail, but I don't like such gray areas. To me, things with __getitem__ are clearly iterable - the glossary says so:-). Iterable's instancecheck is simply buggy ("incomplete", if you want). There might be valid reasons for keeping it buggy, but they should be documented. |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2017-07-17 15:47:49 | veky | set | recipients: + veky, rhettinger, terry.reedy, r.david.murray, Zero, docs@python |
| 2017-07-17 15:47:49 | veky | set | messageid: <1500306469.28.0.0276437456661.issue18558@psf.upfronthosting.co.za> |
| 2017-07-17 15:47:49 | veky | link | issue18558 messages |
| 2017-07-17 15:47:49 | veky | create |
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements
