3 ms·
Where do you see it returning special values? While loops have always stopped on a falsy value.
by StavrosK 8y ago
Where do you see it returning special values? While loops have always stopped on a falsy value.
- mehrdadn 8y agoThe issue is the readBlah() methods. What should they do when they can't read anything? They can return either 0 or an empty result (non-special falsy value), return -1 (special truthy value), return None (special falsy value), or raise an exception. In this case it seems they chose the first option, but this is at odds with something like next(iterator), which similar but raises an exception. It's not clear to me which is the proper pattern anymore, now that they're encouraging assignment.