I looked a bit more and the reason file objects have next() in Py2 is
because "A file object is its own iterator" (
https://docs.python.org/2/library/stdtypes.html#file.next ). This is still
the case in Py3 - "IOBase (and its subclasses) supports the iterator
protocol" (
I forgot about django dropping support for Python2 so I guess you are right
this doesn't make much sense if next() is removed, but for Python2 it would
make sense for django's File object to have the same api as the object
returned by open().
El martes, 15 de agosto de 2017, 19:21:08 (UTC-3),
The next() method is gone from the return value of open() in Python 3 and I
don't think it was every necessary. As per the iterator protcool (
https://docs.python.org/2/library/stdtypes.html#iterator-types ), __iter__
is meant to return an iterator over the object, and *that* is what the
next()
Hello,
I have recently found an interesting issue, using a project that relies on
different storage backends, when switching from a custom one to django's
file system storage, I found that existing code that would iterate files
with the next() call would start to fail, since although django's