Interpret "for i in n" as "for i in range(n)" if n is an int

One of neigboring topics is about defining len() for integer as returning the number of digits:

To be consistent with this idea, iterating an integer should produce its digits. But first we need to discuss some design details:

  • Should it iterate from less significant digits to more significant digits or vice versa? Should the order be locale-dependent?
  • Should it produce characters or integers?
1 Like