iter() not working with datetime.now()
问题 A simple snippet in Python 3.6.1: import datetime j = iter(datetime.datetime.now, None) next(j) returns: Traceback (most recent call last): File "<stdin>", line 1, in <module> StopIteration instead of printing out the classic now() behavior with each next() . I've seen similar code working in Python 3.3, am I missing something or has something changed in version 3.6.1? 回答1: This is definitely a bug introduced in Python 3.6.0b1. The iter() implementation recently switched to using _PyObject