Skip to main content
4 events
when toggle format what by license comment
Jan 4, 2016 at 17:43 comment added Kat So it's pretty much a limitation of the fact that "iterable" isn't a class or something with actual code, but rather a duck typing pattern? Alternatively, it's simply because Python wanted to be so general as to be able to work on any collection with the same implementation (whereas many other standard libraries would just implement it for each collection if it actually applies to that collection).
Dec 27, 2015 at 23:02 comment added nonopolarity I tried in Ruby 2.0 too... Hash and String actually don't have a collection class as a superclass... their superclass are just Object. So these two class just rely on having the Enumerable mixin... something as I understand like an interface to allow for the set of behaviors of a collection
Dec 27, 2015 at 21:29 comment added user7043 OP sort of tries to address this with the module Enumerate section but Python does not work that way, there is no single superclass for all iterators where you could put this method.
Dec 27, 2015 at 21:19 history answered Scant Roger CC BY-SA 3.0