On 7/20/2011 2:21 AM, Stefan Behnel wrote:
Terry Reedy, 19.07.2011 18:31:
Chapter 5 is mostly about the behavior of built-in class instances. For
some classes, like range, instances only come from class calls and the
behavior of instances is intimately tied to the constructor arguments.
Having the constructor described in C.5 might be useful.
I strongly disagree.
Wow. Strongly disagreeing with a mild statement like 'might be useful'
is really strong. But let me explain (using slice rather than range).
Three of the four non-special attributes of the slice objects produced
by the slice() function are the three arguments of the function. (The
fourth is an obscure method.) So the function and its result object are
closely tied together, and unusually so. Hence it *might* be useful to
discuss that particular pair together, especially since both are used
rarely and always together. This is a rather minimal concession to the OP.
But the overall thrust and conclusion of both that post of mine and the
previous one is that 'function' in 'built-in functions' is best
understood generically as including objects of type 'type' as well as
objects of 'builtin_function_or_method' (and any other built-in callable
if there happen to be any). So the rest of your post is strong agreement
with what I have said since the beginning of the thread.
What one needs to know about range is that it produces a non-iterator
re-iterable virtual sequence object that supports a basic subset of the
sequence operations. The function belongs in the function chapter and
the sequence object in the sequence section of the classes chapter.
The OP's point makes more sense in the context of other languages that
make an artificial distinction between functions and constructors and
require that the latter be preceded by keyword new. I prefer Python's
uniformity.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list