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

David Abrahams dave@boost-consulting.com
Mon, 30 Sep 2002 09:27:43 -0400

From: "Alex Martelli" <aleax@aleax.it>

> 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
> uses "built-in" as a noun, I'm not yet sure the editor will let that go
> 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
> is not warranted.  It's important, when feasible, to clarify what
> 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).

It's probably also worth noting that the dict type is not documented
anywhere, except as a function.