class vs type
Colin J. Williams
cjw at sympatico.ca
Fri Oct 19 19:14:03 EDT 2007
Terry Reedy wrote:
> "Colin J. Williams" <cjw at sympatico.ca> wrote in message
> news:ffali6$op5$1 at ger.gmane.org...
> | 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.
>
> Yes, there will not be 'old-style' classes in Py3 and 3.0 doc will not
> mention them.. But we are actually at 2.5 and there will be 2.6, 2.7, 2.8?
> that still have them.
>
>
>
Terry,
Thanks for clarifying the intent.
The Python 3.0 doc, under Class, has:
Programmer’s note: Variables defined in
the class definition are class
variables; they are shared by all
instances. To define instance variables,
they must be given a value in the
__init__() method or in another method.
Both class and instance variables are
accessible through the notation
“self.name“, and an instance variable
hides a class variable with the same
name when accessed in this way. Class
variables with immutable values can be
used as defaults for instance variables.
For new-style classes, descriptors can
be used to create instance variables
with different implementation details.
Presumably, it is intended that every
class implicitly inherits from object?
Colin W.
More information about the Python-list
mailing list