Documentation: type-vs.-function
I note that http://www.python.org/dev/doc/devel/lib/built-in-funcs.html#l2h-14 describes dict as a built-in function, whereas we all know that Guido's cool 2.2 changes made it into a type
dict
Does this distinction matter? A little, I think. Calling it a function
makes it sound like we're living in the past. Same goes for str, type,
list, tuple, et. al. I realize that the type (especially
"David Abrahams"
Does this distinction matter?
Yes. However, I think a few patches changing this have been rejected, on the grounds of being confusing to users. So careful wording is necessary, which probably requires mastery of the English language. Regards, Martin
On Monday 30 September 2002 02:36 am, David Abrahams wrote:
I note that http://www.python.org/dev/doc/devel/lib/built-in-funcs.html#l2h-14 describes dict as a built-in function, whereas we all know that Guido's cool 2.2 changes made it into a type
dict
Does this distinction matter? A little, I think. Calling it a function makes it sound like we're living in the past. Same goes for str, type, list, tuple, et. al. I realize that the type (especially
) acts like a function under many circumstances...
Trying to cover both 2.1 and 2.2 in the coming Nutshell, I've resorted to periphrases such as "the built-in dict" or "the dict built-in" (the latter uses "built-in" as a noun, I'm not yet sure the editor will let that go by). I've also tried to use 'callable' systematically instead of 'function' wherever other callables (types, bound-methods, etc) can be substituted in lieu of functions. In documenting 2.2 or 2.3 only, I think such hedging is not warranted. It's important, when feasible, to clarify what built-ins are types -- a type has MORE functionality than a function, after all (in particular, one can subclass it, while one can't subclass a function). Alex
David Abrahams writes:
Does this distinction matter? A little, I think. Calling it a function makes it sound like we're living in the past. Same goes for str, type, list, tuple, et. al. I realize that the type (especially
) acts like a function under many circumstances...
It definately matters. Alex Martelli writes:
It's important, when feasible, to clarify what built-ins are types -- a type has MORE functionality than a function, after all (in particular, one can subclass it, while one can't subclass a function).
I agree. The current somewhat-vague plan is to add a new section parallel to the section on built-in functions that lists the built-in types exposed in the __builtin__ module. This would make it easier to describe these types and their ability to be subclassed in a more rational manner than in their current location. Placeholder entries will be maintained for the function entries so people accustomed to looking in the current location won't be completely lost. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation
participants (4)
-
Alex Martelli
-
David Abrahams
-
Fred L. Drake, Jr.
-
martin@v.loewis.de