list(), tuple() should not place at "Built-in functions" in documentation

Ben Finney ben+python at
Fri Jul 15 05:47:46 CEST 2011

Inside <fancheyujian at> writes:

> But I can't follow your opinion.Why?because of the list & tuple are
> placed at built-in function,so before I type 'list' unintentionally on
> the pyshell and it show me "<type 'list'>", I never know that the name
> 'list' is a type,I used to consider it's a function to produce 'list'
> type.

That's the kind of fundamental knowledge that one gains by working
through the Python tutorial <URL:>. The
library reference is not the place for teaching that information.

> so,after I figure out this matter,I have to change all my code "assert
> isinstance(someobj, (type([]), type((0, ))))" to "assert
> isinstance(someobj, (list, tuple))",that's not a funny job.

If you think you need to do such assertions, that's a code smell; it's
rare to need that kind of assertion and should only be done with good
reason since it breaks polymorphism. Why are you doing it?

> I hope that I can stay in the Python abstract layer to solve
> problem(although go to the C API is OK but I don't want to),I'm going
> to trust what the doc telling me,so I hope the doc is exact enough.And
> the doc in the distribution maybe the most popular one.

Including the tutorial, so now you have your homework to do :-)

> @Steven D'Aprano,yes they can be used as function,but they aren't
> function and shouldn't confuse newcomers by this.

Agreed; however, it seems reasonable people can disagree on how much
that matters. I think it should be fixed, but not enough to push for it.

 \                 “Leave nothing to chance. Overlook nothing. Combine |
  `\          contradictory observations. Allow yourself enough time.” |
_o__)                                                     —Hippocrates |
Ben Finney

More information about the Python-list mailing list