class vs type

Stargaming stargaming at gmail.com
Sat Oct 20 07:58:38 CEST 2007


On Fri, 19 Oct 2007 12:21:25 -0400, Colin J. Williams wrote:

> Hrvoje Niksic wrote:
>> "Colin J. Williams" <cjw at sympatico.ca> writes:
>> 
>>> In Python Types and Objects, Shalabh Chaturvedi says (in the Python
>>> 3.0 documentation - New Style Classes)
>>>
>>> "The term class is traditionally used to imply an object created by
>>> the class statement. However, classes are now synonymous with types.
>>> Built-in types are usually not referred to as classes. This book
>>> prefers using the term type for both built-in and user created types."
>>>
>>> Do we need two different words to describe what is essentially the
>>> same thing?
>> 
>> We don't, not anymore, which is why the author chooses the word "type"
>> for both in the last sentence.
> In this case, why do we continue to use the word class to generate a
> type?
[snip]
> Doesn't Python 3 provide an opportunity to move away from discussions
> about new_style vs old-style?  This an opportunity to treat old-style
> as a historical artefact, not requiring current explanation.


So, do we have to decide between 'instance' and 'object' as well?

Old-style classes *are* deprecated in favor of new-style classes 
(whoops!) but the term 'class' is still valid (IMO). It's a common phrase 
in the OO-world and removing it from a Python programmer's vocabulary 
(what essentially wouldn't work so well, I suspect) won't help.

If you're speaking about just the syntax, well okay, this could be 
sensible in some unification-focussed vocabulary-minimalistic manner. But 
combining the class _statement_ and the type _expression_ would 
essentially change class definitions into expressions.

Cheers,
Stargaming



More information about the Python-list mailing list