Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee8783d

Browse files
committed
Merged revisions 74817-74820,74822-74824 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r74817 | georg.brandl | 2009-09-16 11:05:11 +0200 (Mi, 16 Sep 2009) | 1 line Make deprecation notices as visible as warnings are right now. ........ r74818 | georg.brandl | 2009-09-16 11:23:04 +0200 (Mi, 16 Sep 2009) | 1 line #6880: add reference to classes section in exceptions section, which comes earlier. ........ r74819 | georg.brandl | 2009-09-16 11:24:57 +0200 (Mi, 16 Sep 2009) | 1 line #6876: fix base class constructor invocation in example. ........ r74820 | georg.brandl | 2009-09-16 11:30:48 +0200 (Mi, 16 Sep 2009) | 1 line #6891: comment out dead link to Unicode article. ........ r74822 | georg.brandl | 2009-09-16 12:12:06 +0200 (Mi, 16 Sep 2009) | 1 line #5621: refactor description of how class/instance attributes interact on a.x=a.x+1 or augassign. ........ r74823 | georg.brandl | 2009-09-16 15:06:22 +0200 (Mi, 16 Sep 2009) | 1 line Remove strange trailing commas. ........ r74824 | georg.brandl | 2009-09-16 15:11:06 +0200 (Mi, 16 Sep 2009) | 1 line #6892: fix optparse example involving help option. ........
1 parent e32fd1d commit ee8783d

7 files changed

Lines changed: 60 additions & 33 deletions

File tree

Doc/howto/unicode.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,12 @@ To help understand the standard, Jukka Korpela has written an introductory guide
211211
to reading the Unicode character tables, available at
212212
<http://www.cs.tut.fi/~jkorpela/unicode/guide.html>.
213213

214-
Two other good introductory articles were written by Joel Spolsky
215-
<http://www.joelonsoftware.com/articles/Unicode.html> and Jason Orendorff
216-
<http://www.jorendorff.com/articles/unicode/>. If this introduction didn't make
217-
things clear to you, you should try reading one of these alternate articles
218-
before continuing.
214+
Another good introductory article was written by Joel Spolsky
215+
<http://www.joelonsoftware.com/articles/Unicode.html>.
216+
If this introduction didn't make things clear to you, you should try reading this
217+
alternate article before continuing.
218+
219+
.. Jason Orendorff XXX http://www.jorendorff.com/articles/unicode/ is broken
219220
220221
Wikipedia entries are often helpful; see the entries for "character encoding"
221222
<http://en.wikipedia.org/wiki/Character_encoding> and UTF-8

Doc/library/optparse.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ user-friendly (documented) options::
467467
action="store_false", dest="verbose",
468468
help="be vewwy quiet (I'm hunting wabbits)")
469469
parser.add_option("-f", "--filename",
470-
metavar="FILE", help="write output to FILE"),
470+
metavar="FILE", help="write output to FILE")
471471
parser.add_option("-m", "--mode",
472472
default="intermediate",
473473
help="interaction mode: novice, intermediate, "
@@ -1014,12 +1014,15 @@ must specify for any option using that action.
10141014

10151015
from optparse import OptionParser, SUPPRESS_HELP
10161016

1017-
parser = OptionParser()
1018-
parser.add_option("-h", "--help", action="help"),
1017+
# usually, a help option is added automatically, but that can
1018+
# be suppressed using the add_help_option argument
1019+
parser = OptionParser(add_help_option=False)
1020+
1021+
parser.add_option("-h", "--help", action="help")
10191022
parser.add_option("-v", action="store_true", dest="verbose",
10201023
help="Be moderately verbose")
10211024
parser.add_option("--file", dest="filename",
1022-
help="Input file to read data from"),
1025+
help="Input file to read data from")
10231026
parser.add_option("--secret", help=SUPPRESS_HELP)
10241027

10251028
If :mod:`optparse` sees either ``"-h"`` or ``"--help"`` on the command line, it

Doc/library/readline.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ support history save/restore. ::
205205
class HistoryConsole(code.InteractiveConsole):
206206
def __init__(self, locals=None, filename="<console>",
207207
histfile=os.path.expanduser("~/.console-history")):
208-
code.InteractiveConsole.__init__(self)
208+
code.InteractiveConsole.__init__(self, locals, filename)
209209
self.init_history(histfile)
210210

211211
def init_history(self, histfile):

Doc/reference/simple_stmts.rst

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,25 @@ Assignment of an object to a single target is recursively defined as follows.
170170
perform the assignment, it raises an exception (usually but not necessarily
171171
:exc:`AttributeError`).
172172

173+
.. _attr-target-note:
174+
175+
Note: If the object is a class instance and the attribute reference occurs on
176+
both sides of the assignment operator, the RHS expression, ``a.x`` can access
177+
either an instance attribute or (if no instance attribute exists) a class
178+
attribute. The LHS target ``a.x`` is always set as an instance attribute,
179+
creating it if necessary. Thus, the two occurrences of ``a.x`` do not
180+
necessarily refer to the same attribute: if the RHS expression refers to a
181+
class attribute, the LHS creates a new instance attribute as the target of the
182+
assignment::
183+
184+
class Cls:
185+
x = 3 # class variable
186+
inst = Cls()
187+
inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3
188+
189+
This description does not necessarily apply to descriptor attributes, such as
190+
properties created with :func:`property`.
191+
173192
.. index::
174193
pair: subscription; assignment
175194
object: mutable
@@ -276,16 +295,8 @@ same way as normal assignments. Similarly, with the exception of the possible
276295
*in-place* behavior, the binary operation performed by augmented assignment is
277296
the same as the normal binary operations.
278297

279-
For targets which are attribute references, the initial value is retrieved with
280-
a :meth:`getattr` and the result is assigned with a :meth:`setattr`. Notice
281-
that the two methods do not necessarily refer to the same variable. When
282-
:meth:`getattr` refers to a class variable, :meth:`setattr` still writes to an
283-
instance variable. For example::
284-
285-
class A:
286-
x = 3 # class variable
287-
a = A()
288-
a.x += 1 # writes a.x as 4 leaving A.x as 3
298+
For targets which are attribute references, the same :ref:`caveat about class
299+
and instance attributes <attr-target-note>` applies as for regular assignments.
289300

290301

291302
.. _assert:

Doc/tools/sphinxext/pyspecific.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@
2020
Body.enum.converters['lowerroman'] = \
2121
Body.enum.converters['upperroman'] = lambda x: None
2222

23+
# monkey-patch HTML translator to give versionmodified paragraphs a class
24+
def new_visit_versionmodified(self, node):
25+
self.body.append(self.starttag(node, 'p', CLASS=node['type']))
26+
text = versionlabels[node['type']] % node['version']
27+
if len(node):
28+
text += ': '
29+
else:
30+
text += '.'
31+
self.body.append('<span class="versionmodified">%s</span>' % text)
32+
33+
from sphinx.writers.html import HTMLTranslator
34+
from sphinx.locale import versionlabels
35+
HTMLTranslator.visit_versionmodified = new_visit_versionmodified
36+
2337

2438
def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
2539
issue = utils.unescape(text)

Doc/tools/sphinxext/static/basic.css

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55

66
/* -- main layout ----------------------------------------------------------- */
77

8-
div.documentwrapper {
9-
float: left;
10-
width: 100%;
11-
}
12-
13-
div.bodywrapper {
14-
margin: 0 0 0 230px;
15-
}
16-
178
div.clearer {
189
clear: both;
1910
}
@@ -338,6 +329,12 @@ dl.glossary dt {
338329
font-style: italic;
339330
}
340331

332+
p.deprecated {
333+
background-color: #ffe4e4;
334+
border: 1px solid #f66;
335+
padding: 7px
336+
}
337+
341338
.system-message {
342339
background-color: #fda;
343340
padding: 5px;
@@ -394,7 +391,7 @@ img.math {
394391
vertical-align: middle;
395392
}
396393

397-
div.math p {
394+
div.body div.math p {
398395
text-align: center;
399396
}
400397

Doc/tutorial/errors.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,10 @@ re-raise the exception::
242242
User-defined Exceptions
243243
=======================
244244

245-
Programs may name their own exceptions by creating a new exception class.
246-
Exceptions should typically be derived from the :exc:`Exception` class, either
247-
directly or indirectly. For example::
245+
Programs may name their own exceptions by creating a new exception class (see
246+
:ref:`tut-classes` for more about Python classes). Exceptions should typically
247+
be derived from the :exc:`Exception` class, either directly or indirectly. For
248+
example::
248249

249250
>>> class MyError(Exception):
250251
... def __init__(self, value):

0 commit comments

Comments
 (0)