[issue14528] Document whether strings implement __iter__

2012-04-08 Thread Chris Jerdonek
Chris Jerdonek added the comment: Is there a mechanism for suggesting improvements to the documentation (e.g. for pedagogical reasons)? I tried to classify this as an enhancement request rather than as a bug. -- ___ Python tracker

[issue14528] Document whether strings implement __iter__

2012-04-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: Sorry, I agree with Georg, this isn't a bug, not even a documentation bug. A type is free to implement iteration either by way of __iter__ or by way of __getitem__. How it chooses to do so is an implementation detail (and different implementations have m

[issue14528] Document whether strings implement __iter__

2012-04-08 Thread Chris Jerdonek
Chris Jerdonek added the comment: Okay, then that also might be worth mentioning. As it stands now, the emphasis in the section on iterator types is on __iter__() (e.g. it is the main focus of the introduction), whereas iter() is barely mentioned (only in the sections on dicts and file objec

[issue14528] Document whether strings implement __iter__

2012-04-08 Thread Georg Brandl
Georg Brandl added the comment: "behaves like a list" is misleading. If you mean checking for iterable-ness, calling iter() on the object is the way to do it. -- ___ Python tracker __

[issue14528] Document whether strings implement __iter__

2012-04-08 Thread Chris Jerdonek
Chris Jerdonek added the comment: It is not "so important." I just feel that the change should be acknowledged somewhere -- insofar as the existing user documentation on iterator types already discusses __iter__(). As it stands now, the Python 2 documentation is a bit misleading because it

[issue14528] Document whether strings implement __iter__

2012-04-08 Thread Georg Brandl
Georg Brandl added the comment: Why is it so important if strings implement __iter__? They are iterable in both versions, since iteration falls back on __getitem__ if no __iter__ is defined. For user code it is irrelevant which of the iteration protocols is present. -- nosy: +georg

[issue14528] Document whether strings implement __iter__

2012-04-08 Thread Chris Jerdonek
New submission from Chris Jerdonek : While converting code from Python 2 to Python 3, I came across the "gotcha" that strings implement __iter__ in Python 3 but not in Python 2. Looking through the documentation, I don't seem to see anything like this mentioned in the library portion of either