What is the difference between 'type' and 'class'?

Terry Reedy tjreedy at udel.edu
Mon Jun 21 22:01:28 EDT 2010


On 6/21/2010 6:11 PM, Peng Yu wrote:
> pydoc xrange says:
>
> Help on class xrange in module __builtin__:
>
> class xrange(object)
>
> python_2.6.5_library.pdf says:
>
> Objects of type xrange are similar to buffers
>
> Are type and class synonyms? It seems that they are at least according
> to some webpages that I read. But I'm not completely sure. Could you
> let me know in case my impress is wrong?

Additional answer:
'type' is the name of the built-in (meta)class that reveals the class of 
existing objects (one argument) and creates new classes (three arguments 
of the proper class/type ;-).


-- 
Terry Jan Reedy




More information about the Python-list mailing list