[Python-Dev] Documentation: type-vs.-function

Alex Martelli aleax@aleax.it
Mon, 30 Sep 2002 08:38:54 +0200


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
>
>   <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 <type 'type'>)
> 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