Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
4cf0e147
Commit
4cf0e147
authored
Oct 21, 2007
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add :term:s for "new-style class".
parent
a181d9ac
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
27 additions
and
20 deletions
+27
-20
Doc/glossary.rst
Doc/glossary.rst
+4
-0
Doc/library/ctypes.rst
Doc/library/ctypes.rst
+1
-1
Doc/library/functions.rst
Doc/library/functions.rst
+5
-5
Doc/library/logging.rst
Doc/library/logging.rst
+1
-1
Doc/library/pickle.rst
Doc/library/pickle.rst
+5
-5
Doc/library/sqlite3.rst
Doc/library/sqlite3.rst
+1
-1
Doc/library/xmlrpclib.rst
Doc/library/xmlrpclib.rst
+3
-2
Doc/reference/compound_stmts.rst
Doc/reference/compound_stmts.rst
+3
-2
Doc/reference/datamodel.rst
Doc/reference/datamodel.rst
+1
-0
Doc/tutorial/classes.rst
Doc/tutorial/classes.rst
+2
-2
Doc/using/cmdline.rst
Doc/using/cmdline.rst
+1
-1
No files found.
Doc/glossary.rst
View file @
4cf0e147
...
@@ -255,6 +255,8 @@ Glossary
...
@@ -255,6 +255,8 @@ Glossary
powerful, elegant solutions. They have been used for logging attribute
powerful, elegant solutions. They have been used for logging attribute
access, adding thread-safety, tracking object creation, implementing
access, adding thread-safety, tracking object creation, implementing
singletons, and many other tasks.
singletons, and many other tasks.
More information can be found in :ref:`metaclasses`.
mutable
mutable
Mutable objects can change their value but keep their :func:`id`. See
Mutable objects can change their value but keep their :func:`id`. See
...
@@ -286,6 +288,8 @@ Glossary
...
@@ -286,6 +288,8 @@ Glossary
use Python's newer, versatile features like :attr:`__slots__`,
use Python's newer, versatile features like :attr:`__slots__`,
descriptors, properties, :meth:`__getattribute__`, class methods, and
descriptors, properties, :meth:`__getattribute__`, class methods, and
static methods.
static methods.
More information can be found in :ref:`newstyle`.
Python 3000
Python 3000
Nickname for the next major Python version, 3.0 (coined long ago when the
Nickname for the next major Python version, 3.0 (coined long ago when the
...
...
Doc/library/ctypes.rst
View file @
4cf0e147
...
@@ -1950,7 +1950,7 @@ Data types
...
@@ -1950,7 +1950,7 @@ Data types
in case the memory block contains pointers.
in case the memory block contains pointers.
Common methods of ctypes data types, these are all class methods (to be exact,
Common methods of ctypes data types, these are all class methods (to be exact,
they are methods of the
metaclass
):
they are methods of the
:term:`metaclass`
):
.. method:: _CData.from_address(address)
.. method:: _CData.from_address(address)
...
...
Doc/library/functions.rst
View file @
4cf0e147
...
@@ -350,7 +350,7 @@ available. They are listed here in alphabetical order.
...
@@ -350,7 +350,7 @@ available. They are listed here in alphabetical order.
The
*
expression
*
argument
is
parsed
and
evaluated
as
a
Python
expression
The
*
expression
*
argument
is
parsed
and
evaluated
as
a
Python
expression
(
technically
speaking
,
a
condition
list
)
using
the
*
globals
*
and
*
locals
*
(
technically
speaking
,
a
condition
list
)
using
the
*
globals
*
and
*
locals
*
dictionaries
as
global
and
local
name
space
.
If
the
*
globals
*
dictionary
is
dictionaries
as
global
and
local
namespace
.
If
the
*
globals
*
dictionary
is
present
and
lacks
'__builtins__'
,
the
current
globals
are
copied
into
*
globals
*
present
and
lacks
'__builtins__'
,
the
current
globals
are
copied
into
*
globals
*
before
*
expression
*
is
parsed
.
This
means
that
*
expression
*
normally
has
full
before
*
expression
*
is
parsed
.
This
means
that
*
expression
*
normally
has
full
access
to
the
standard
:
mod
:`
__builtin__
`
module
and
restricted
environments
are
access
to
the
standard
:
mod
:`
__builtin__
`
module
and
restricted
environments
are
...
@@ -808,8 +808,8 @@ available. They are listed here in alphabetical order.
...
@@ -808,8 +808,8 @@ available. They are listed here in alphabetical order.
.. function:: property([fget[, fset[, fdel[, doc]]]])
.. function:: property([fget[, fset[, fdel[, doc]]]])
Return a property attribute for
new-style classes (classes that derive from
Return a property attribute for
:term:`new-style class`\es (classes that
:class:`object`).
derive from
:class:`object`).
*fget* is a function for getting an attribute value, likewise *fset* is a
*fget* is a function for getting an attribute value, likewise *fset* is a
function for setting, and *fdel* a function for del'
ing
,
an
attribute
.
Typical
function for setting, and *fdel* a function for del'
ing
,
an
attribute
.
Typical
...
@@ -1112,8 +1112,8 @@ available. They are listed here in alphabetical order.
...
@@ -1112,8 +1112,8 @@ available. They are listed here in alphabetical order.
Return the superclass of *type*. If the second argument is omitted the super
Return the superclass of *type*. If the second argument is omitted the super
object returned is unbound. If the second argument is an object,
object returned is unbound. If the second argument is an object,
``isinstance(obj, type)`` must be true. If the second argument is a type,
``isinstance(obj, type)`` must be true. If the second argument is a type,
``issubclass(type2, type)`` must be true. :func:`super` only works for
new-style
``issubclass(type2, type)`` must be true. :func:`super` only works for
class
es.
:term:`new-style class`\
es.
A typical use for calling a cooperative superclass method is::
A typical use for calling a cooperative superclass method is::
...
...
Doc/library/logging.rst
View file @
4cf0e147
...
@@ -22,7 +22,7 @@ logging system for applications.
...
@@ -22,7 +22,7 @@ logging system for applications.
Logging
is
performed
by
calling
methods
on
instances
of
the
:
class
:`
Logger
`
Logging
is
performed
by
calling
methods
on
instances
of
the
:
class
:`
Logger
`
class
(
hereafter
called
:
dfn
:`
loggers
`).
Each
instance
has
a
name
,
and
they
are
class
(
hereafter
called
:
dfn
:`
loggers
`).
Each
instance
has
a
name
,
and
they
are
conceptually
arranged
in
a
name
space
hierarchy
using
dots
(
periods
)
as
conceptually
arranged
in
a
namespace
hierarchy
using
dots
(
periods
)
as
separators
.
For
example
,
a
logger
named
"scan"
is
the
parent
of
loggers
separators
.
For
example
,
a
logger
named
"scan"
is
the
parent
of
loggers
"scan.text"
,
"scan.html"
and
"scan.pdf"
.
Logger
names
can
be
anything
you
want
,
"scan.text"
,
"scan.html"
and
"scan.pdf"
.
Logger
names
can
be
anything
you
want
,
and
indicate
the
area
of
an
application
in
which
a
logged
message
originates
.
and
indicate
the
area
of
an
application
in
which
a
logged
message
originates
.
...
...
Doc/library/pickle.rst
View file @
4cf0e147
...
@@ -122,7 +122,7 @@ There are currently 3 different protocols which can be used for pickling.
...
@@ -122,7 +122,7 @@ There are currently 3 different protocols which can be used for pickling.
earlier versions of Python.
earlier versions of Python.
* Protocol version 2 was introduced in Python 2.3. It provides much more
* Protocol version 2 was introduced in Python 2.3. It provides much more
efficient pickling of
new-style class
es.
efficient pickling of
:term:`new-style class`\
es.
Refer to :pep:`307` for more information.
Refer to :pep:`307` for more information.
...
@@ -430,8 +430,8 @@ New-style types can provide a :meth:`__getnewargs__` method that is used for
...
@@ -430,8 +430,8 @@ New-style types can provide a :meth:`__getnewargs__` method that is used for
protocol 2. Implementing this method is needed if the type establishes some
protocol 2. Implementing this method is needed if the type establishes some
internal invariants when the instance is created, or if the memory allocation is
internal invariants when the instance is created, or if the memory allocation is
affected by the values passed to the :meth:`__new__` method for the type (as it
affected by the values passed to the :meth:`__new__` method for the type (as it
is for tuples and strings). Instances of a
new-style type :class:`C` are
is for tuples and strings). Instances of a
:term:`new-style class` :class:`C`
created using ::
are
created using ::
obj = C.__new__(C, *args)
obj = C.__new__(C, *args)
...
@@ -459,8 +459,8 @@ can do what they want. [#]_
...
@@ -459,8 +459,8 @@ can do what they want. [#]_
.. warning::
.. warning::
For
new-style classes, if :meth:`__getstate__` returns a false value, th
e
For
:term:`new-style class`\es, if :meth:`__getstate__` returns a fals
e
:meth:`__setstate__` method will not be called.
value, the
:meth:`__setstate__` method will not be called.
Pickling and unpickling extension types
Pickling and unpickling extension types
...
...
Doc/library/sqlite3.rst
View file @
4cf0e147
...
@@ -549,7 +549,7 @@ string representation and register the function with :meth:`register_adapter`.
...
@@ -549,7 +549,7 @@ string representation and register the function with :meth:`register_adapter`.
.. note::
.. note::
The type/class to adapt must be a
new-style class
, i. e. it must have
The type/class to adapt must be a
:term:`new-style class`
, i. e. it must have
:class:`object` as one of its bases.
:class:`object` as one of its bases.
.. literalinclude:: ../includes/sqlite3/adapter_point_2.py
.. literalinclude:: ../includes/sqlite3/adapter_point_2.py
...
...
Doc/library/xmlrpclib.rst
View file @
4cf0e147
...
@@ -113,8 +113,9 @@ between conformable Python objects and XML on the wire.
...
@@ -113,8 +113,9 @@ between conformable Python objects and XML on the wire.
The *use_datetime* flag was added.
The *use_datetime* flag was added.
.. versionchanged:: 2.6
.. versionchanged:: 2.6
Instances of new-style classes can be passed in if they have an *__dict__*
Instances of :term:`new-style class`\es can be passed in if they have an
attribute and don't have a base class that is marshalled in a special way.
*__dict__* attribute and don't have a base class that is marshalled in a
special way.
.. seealso::
.. seealso::
...
...
Doc/reference/compound_stmts.rst
View file @
4cf0e147
...
@@ -534,8 +534,9 @@ must be given a value in the :meth:`__init__` method or in another method. Both
...
@@ -534,8 +534,9 @@ must be given a value in the :meth:`__init__` method or in another method. Both
class and instance variables are accessible through the notation
class and instance variables are accessible through the notation
"``self.name``", and an instance variable hides a class variable with the same
"``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
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
used as defaults for instance variables. For :term:`new-style class`\es,
be used to create instance variables with different implementation details.
descriptors can be used to create instance variables with different
implementation details.
.. rubric:: Footnotes
.. rubric:: Footnotes
...
...
Doc/reference/datamodel.rst
View file @
4cf0e147
...
@@ -1082,6 +1082,7 @@ Internal types
...
@@ -1082,6 +1082,7 @@ Internal types
.. % Types
.. % Types
.. % =========================================================================
.. % =========================================================================
.. _newstyle:
New-style and classic classes
New-style and classic classes
=============================
=============================
...
...
Doc/tutorial/classes.rst
View file @
4cf0e147
...
@@ -495,8 +495,8 @@ figure out the consequences of a name conflict with an attribute of
...
@@ -495,8 +495,8 @@ figure out the consequences of a name conflict with an attribute of
:class:`Base2`. The depth-first rule makes no differences between direct and
:class:`Base2`. The depth-first rule makes no differences between direct and
inherited attributes of :class:`Base1`.)
inherited attributes of :class:`Base1`.)
For
new-style classes, the method resolution order changes dynamically to
For
:term:`new-style class`\es, the method resolution order changes dynamically
support cooperative calls to :func:`super`. This approach is known in some
to
support cooperative calls to :func:`super`. This approach is known in some
other multiple-inheritance languages as call-next-method and is more powerful
other multiple-inheritance languages as call-next-method and is more powerful
than the super call found in single-inheritance languages.
than the super call found in single-inheritance languages.
...
...
Doc/using/cmdline.rst
View file @
4cf0e147
...
@@ -373,7 +373,7 @@ Environment variables
...
@@ -373,7 +373,7 @@ Environment variables
If this is the name of a readable file, the Python commands in that file are
If this is the name of a readable file, the Python commands in that file are
executed before the first prompt is displayed in interactive mode. The file
executed before the first prompt is displayed in interactive mode. The file
is executed in the same name
space where interactive commands are executed so
is executed in the same namespace where interactive commands are executed so
that objects defined or imported in it can be used without qualification in
that objects defined or imported in it can be used without qualification in
the interactive session. You can also change the prompts :data:`sys.ps1` and
the interactive session. You can also change the prompts :data:`sys.ps1` and
:data:`sys.ps2` in this file.
:data:`sys.ps2` in this file.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment