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
5c08a99b
Commit
5c08a99b
authored
Aug 14, 2002
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove a broken example of extreme backward compatibility; it is
simply not relevant any more. Closes SF bug #595032.
parent
80c02af3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
21 deletions
+0
-21
Doc/tut/tut.tex
Doc/tut/tut.tex
+0
-21
No files found.
Doc/tut/tut.tex
View file @
5c08a99b
...
...
@@ -4018,27 +4018,6 @@ code that is byte-compiled together. The same restriction applies to
\code
{
getattr()
}
,
\code
{
setattr()
}
and
\code
{
delattr()
}
, as well as
when referencing
\code
{__
dict
__}
directly.
Here's an example of a class that implements its own
\method
{__
getattr
__
()
}
and
\method
{__
setattr
__
()
}
methods and stores
all attributes in a private variable, in a way that works in all
versions of Python, including those available before this feature was
added:
\begin{verbatim}
class VirtualAttributes:
__
vdict = None
__
vdict
_
name = locals().keys()[0]
def
__
init
__
(self):
self.
__
dict
__
[self.
__
vdict
_
name] =
{}
def
__
getattr
__
(self, name):
return self.
__
vdict[name]
def
__
setattr
__
(self, name, value):
self.
__
vdict[name] = value
\end{verbatim}
\section
{
Odds and Ends
\label
{
odds
}}
...
...
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