A sequence object is a special, C-provided type. A generator can be written with user code.
This is a Python 2 thing - in Python 3:
>>> print(type(range(1))) <class 'range'> >>> print(type(xrange(1))) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'xrange' is not defined
python2:
Python 2.7.5+ (default, Feb 27 2014, 19:37:08) [GCC 4.8.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print type(xrange(1)) <type 'xrange'>
johntellsall
source share