@@ -2175,7 +2175,7 @@ \section{Dictionaries \label{dictionaries}}
21752175\begin {verbatim }
21762176>>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)])
21772177{'sape': 4139, 'jack': 4098, 'guido': 4127}
2178- >>> dict([(x, x**2) for x in (2, 4, 6)) # use a list comprehension
2178+ >>> dict([(x, x**2) for x in (2, 4, 6)] ) # use a list comprehension
21792179{2: 4, 4: 16, 6: 36}
21802180\end {verbatim }
21812181
@@ -4193,6 +4193,7 @@ \subsection{Multiple Inheritance \label{multiple}}
41934193variables'' or data attributes used by the common base class), it is
41944194not clear that these semantics are in any way useful.
41954195
4196+ % % XXX Add rules for new-style MRO?
41964197
41974198\section {Private Variables \label {private } }
41984199
@@ -4201,9 +4202,9 @@ \section{Private Variables \label{private}}
42014202leading underscores, at most one trailing underscore) is textually
42024203replaced with \code {_classname__spam}, where \code {classname} is the
42034204current class name with leading underscore(s) stripped. This mangling
4204- is done without regard of the syntactic position of the identifier, so
4205+ is done without regard to the syntactic position of the identifier, so
42054206it can be used to define class-private instance and class variables,
4206- methods, as well as globals, and even to store instance variables
4207+ methods, variables stored in globals, and even variables stored in instances.
42074208private to this class on instances of \emph {other } classes. Truncation
42084209may occur when the mangled name would be longer than 255 characters.
42094210Outside classes, or when the class name consists of only underscores,
@@ -4232,7 +4233,7 @@ \section{Private Variables \label{private}}
42324233\section {Odds and Ends \label {odds } }
42334234
42344235Sometimes it is useful to have a data type similar to the Pascal
4235- `` record'' or C `` struct'' , bundling together a couple of named data
4236+ `` record'' or C `` struct'' , bundling together a few named data
42364237items. An empty class definition will do nicely:
42374238
42384239\begin {verbatim }
@@ -4251,7 +4252,7 @@ \section{Odds and Ends \label{odds}}
42514252can often be passed a class that emulates the methods of that data
42524253type instead. For instance, if you have a function that formats some
42534254data from a file object, you can define a class with methods
4254- \method {read()} and \method {readline()} that gets the data from a string
4255+ \method {read()} and \method {readline()} that get the data from a string
42554256buffer instead, and pass it as an argument.% (Unfortunately, this
42564257% technique has its limitations: a class can't define operations that
42574258% are accessed by special syntax such as sequence subscripting or
@@ -4261,7 +4262,7 @@ \section{Odds and Ends \label{odds}}
42614262
42624263
42634264Instance method objects have attributes, too: \code {m.im_self} is the
4264- object of which the method is an instance , and \code {m.im_func} is the
4265+ instance object with the method \method {m} , and \code {m.im_func} is the
42654266function object corresponding to the method.
42664267
42674268
@@ -4530,7 +4531,7 @@ \section{File Wildcards\label{file-wildcards}}
45304531
45314532\section {Command Line Arguments\label {command-line-arguments } }
45324533
4533- Common utility scripts often invoke processing command line arguments.
4534+ Common utility scripts often need to process command line arguments.
45344535These arguments are stored in the
45354536\ulink {\module {sys}}{../lib/module-sys.html}\ module's \var {argv}
45364537attribute as a list. For instance the following output results from
@@ -4557,7 +4558,7 @@ \section{Error Output Redirection and Program Termination\label{stderr}}
45574558messages to make them visible even when \var {stdout} has been redirected:
45584559
45594560\begin {verbatim }
4560- >>> sys.stderr.write('Warning, log file not found starting a new one')
4561+ >>> sys.stderr.write('Warning, log file not found starting a new one\n ')
45614562Warning, log file not found starting a new one
45624563\end {verbatim }
45634564
@@ -4636,7 +4637,7 @@ \section{Internet Access\label{internet-access}}
46364637>>> import smtplib
46374638>>> server = smtplib.SMTP('localhost')
463846394639- """To: jceasar @example.org
4640+ """To: jcaesar @example.org
4640464146414642
46424643Beware the Ides of March.
@@ -4660,8 +4661,8 @@ \section{Dates and Times\label{dates-and-times}}
46604661>>> now = date.today()
46614662>>> now
46624663datetime.date(2003, 12, 2)
4663- >>> now.strftime("%m-%d-%y or %d %b %Y is a %A on the %d day of %B")
4664- '12-02-03 or 02Dec 2003 is a Tuesday on the 02 day of December'
4664+ >>> now.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B. ")
4665+ '12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December. '
46654666
46664667# dates support calendar arithmetic
46674668>>> birthday = date(1964, 7, 31)
@@ -4691,8 +4692,8 @@ \section{Data Compression\label{data-compression}}
4691469237
46924693>>> zlib.decompress(t)
46934694'witch which has which witches wrist watch'
4694- >>> zlib.crc32(t )
4695- -1438085031
4695+ >>> zlib.crc32(s )
4696+ 226805979
46964697\end {verbatim }
46974698
46984699
@@ -5219,7 +5220,7 @@ \section{Decimal Floating Point Arithmetic\label{decimal-fp}}
52195220\chapter {What Now? \label {whatNow } }
52205221
52215222Reading this tutorial has probably reinforced your interest in using
5222- Python --- you should be eager to apply Python to solve your
5223+ Python --- you should be eager to apply Python to solving your
52235224real-world problems. Now what should you do?
52245225
52255226You should read, or at least page through, the
@@ -5382,7 +5383,7 @@ \section{Key Bindings \label{keyBindings}}
53825383this deletes the names it creates once they are no longer needed; this
53835384is done since the startup file is executed in the same namespace as
53845385the interactive commands, and removing the names avoids creating side
5385- effects in the interactive environments . You may find it convenient
5386+ effects in the interactive environment . You may find it convenient
53865387to keep some of the imported modules, such as
53875388\ulink {\module {os}}{../lib/module-os.html}, which turn
53885389out to be needed in most sessions with the interpreter.
@@ -5474,7 +5475,7 @@ \chapter{Floating Point Arithmetic: Issues and Limitations\label{fp-issues}}
54745475
54755476and so on. No matter how many digits you're willing to write down, the
54765477result will never be exactly 1/3, but will be an increasingly better
5477- approximation to 1/3.
5478+ approximation of 1/3.
54785479
54795480In the same way, no matter how many base 2 digits you're willing to
54805481use, the decimal value 0.1 cannot be represented exactly as a base 2
@@ -5520,7 +5521,7 @@ \chapter{Floating Point Arithmetic: Issues and Limitations\label{fp-issues}}
55205521\var {x}, but rounding to 16 digits is not enough to make that true.
55215522
55225523Note that this is in the very nature of binary floating-point: this is
5523- not a bug in Python, it is not a bug in your code either, and you 'll
5524+ not a bug in Python, it is not a bug in your code either. You 'll
55245525see the same kind of thing in all languages that support your
55255526hardware's floating-point arithmetic (although some languages may
55265527not \emph {display } the difference by default, or in all output modes).
@@ -5634,7 +5635,7 @@ \section{Representation Error
56345635\code {< 2**53}), the best value for \var {N} is 56:
56355636
56365637\begin {verbatim }
5637- >>> 2L **52
5638+ >>> 2 **52
563856394503599627370496L
56395640>>> 2L**53
564056419007199254740992L
0 commit comments