iter() not working with datetime.now()

Viewed 1621

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?

2 Answers
Related