A common misconception in communicating Python is
that range() and even list() are "function calls".  That's
correct for range() in 2.x:

>>> type(range)
<type 'builtin_function_or_method'>

but has never been correct terminology regarding list().

Example:

"""
>From Chapter 9 of Inventing in Python:

The range() and list() Functions

When called with one argument, range() will return a range object of
integers from 0 up to (but not including) the argument. This range object
can be converted to the more familiar list data type with the list()
function. Try entering list(range(10)) into the interactive shell:
"""

The author knows a range object is returned, however that's
our clue that range() is calling a type (a class) and returning
an instance of that class, ditto list( ).

I'd like to see the Python 3.x teaching literature not muddying
the waters by referring to range() and list() -- and zip() and
enumerate() -- as "function calls".

Kirby
_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
https://mail.python.org/mailman/listinfo/edu-sig

Reply via email to