4 ms·
Ha! Too much Go for me. It does actually, my bad, I expected the variable to be ignored (and the range creation isn't a big deal usually as it's just a generato
by lclarkmichalek 13y ago
Ha! Too much Go for me. It does actually, my bad, I expected the variable to be ignored (and the range creation isn't a big deal usually as it's just a generator).
- wasabian 13y agoUsing range would create the whole list. xrange is the one that acts like a generator :)
- andreasvc 13y agoThis Enum is slated to be introduced in Python 3.4, where range is (not acts like) a generator.
- wasabian 13y agoAh. I stand corrected :)
- omaranto 13y agoBut even with a generator, as you would get from range in Python 3, the assignment a, *b = range(10) makes b into a list. (And I think the star syntax in assignments is only Python 3, as far as I remember Python 2 only has star in argument lists of functions.)
- __del__ 13y agoYou're right, python2 doesn't have the extended unpacking (star) syntax. Furthermore, this: >>> a, *b = range(2**128) Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: Python int too large to convert to C ssize_t Ha.