Raymond Hettinger
f59e962b49
Refactor if/elif chain for clarity and speed. Remove dependency on subclasses having to implement _empty and _full.
2008-01-15 20:52:42 +00:00
Jeffrey Yasskin
d7b00334f3
Add rational.Rational as an implementation of numbers.Rational with infinite
...
precision. This has been discussed at http://bugs.python.org/issue1682 . It's
useful primarily for teaching, but it also demonstrates how to implement a
member of the numeric tower, including fallbacks for mixed-mode arithmetic.
I expect to write a couple more patches in this area:
* Rational.from_decimal()
* Rational.trim/approximate() (maybe with different names)
* Maybe remove the parentheses from Rational.__str__()
* Maybe rename one of the Rational classes
* Maybe make Rational('3/2') work.
2008-01-15 07:46:24 +00:00
Raymond Hettinger
907cda6ebb
Small grammar nit
2008-01-15 05:46:43 +00:00
Skip Montanaro
f233b0c454
Better (?) text describing the lack of guarantees provided by qsize(),
...
empty() and full().
2008-01-15 03:40:20 +00:00
Andrew M. Kuchling
f15ff46be5
Markup fix
2008-01-15 01:29:44 +00:00
Andrew M. Kuchling
7ce9b18460
Typo fixes
2008-01-15 01:29:16 +00:00
Christian Heimes
c94e2b5c12
Now that I've learnt about structseq objects I felt like converting sys.float_info to a structseq. It's
...
readonly and help(sys.float_info) explains the attributes nicely.
2008-01-14 04:13:37 +00:00
Christian Heimes
f31b69f9db
Applied patch #1816 : sys.flags patch
2008-01-14 03:42:48 +00:00
Georg Brandl
9f1e2ecb48
Clarify the effect of text mode.
2008-01-13 09:36:18 +00:00
Georg Brandl
fca4e1ffa1
Fix editing glitch.
2008-01-12 16:11:09 +00:00
Georg Brandl
57fe0f2902
Move OSError docs to exceptions doc, remove obsolete descriptions
...
from os docs, rework posix docs.
2008-01-12 10:53:29 +00:00
Mark Dickinson
59bc20bb27
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
...
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
2008-01-12 01:56:00 +00:00
Raymond Hettinger
bed4dd459d
Update the opcode docs for STORE_MAP and BUILD_MAP
2008-01-11 23:25:18 +00:00
Andrew M. Kuchling
de68037202
Bug #1790 : update link; remove outdated paragraph
2008-01-11 19:33:24 +00:00
Georg Brandl
e3c3db59b5
Documentation for r5990[3567].
2008-01-11 09:55:53 +00:00
Raymond Hettinger
d1ef85420f
Run doctests on the collections module
2008-01-11 00:23:13 +00:00
Raymond Hettinger
15b5e55b48
Neaten-up the named tuple docs
2008-01-10 23:00:01 +00:00
Amaury Forgeot d'Arc
d08a8ebf2a
Closing issue1761.
...
Surprising behaviour of the "$" regexp: it matches the
end of the string, AND just before the newline at the end
of the string::
re.sub('$', '#', 'foo\n') == 'foo#\n#'
Python is consistent with Perl and the pcre library, so
we just document it.
Guido prefers "\Z" to match only the end of the string.
2008-01-10 21:59:42 +00:00
Raymond Hettinger
e850c466c7
Clarify how to add a field to a named tuple.
2008-01-10 20:37:12 +00:00
Raymond Hettinger
e1655088ca
Examples for named tuple subclassing should include __slots__
2008-01-10 19:15:10 +00:00
Raymond Hettinger
dc1854dec4
Fix typo
2008-01-09 03:13:20 +00:00
Raymond Hettinger
e11230e11b
Syntax highlighting only works when >>> lines are accompanied by ... lines
2008-01-09 03:02:23 +00:00
Georg Brandl
502d6312db
Fix markup errors from r59857 and clarify key.__enter__/__exit__ docs
2008-01-08 16:18:26 +00:00
Christian Heimes
b39a756afd
Added __enter__ and __exit__ functions to HKEY object
...
Added ExpandEnvironmentStrings to the _winreg module.
2008-01-08 15:46:10 +00:00
Andrew M. Kuchling
e0a49b6e05
Patch 1137: allow assigning to .buffer_size attribute of PyExpat.parser objects
2008-01-08 14:30:55 +00:00
Raymond Hettinger
ac5742e0fe
Docs on named tuple's naming conventions and limits of subclassing
2008-01-08 02:24:15 +00:00
Raymond Hettinger
f6b769b464
Documentation nits.
2008-01-07 21:33:51 +00:00
Raymond Hettinger
f5e8af1bb7
Use get() instead of pop() for the optimized version of _replace().
2008-01-07 20:56:05 +00:00
Raymond Hettinger
fb3ced663d
Minor markup fix
2008-01-07 20:17:35 +00:00
Raymond Hettinger
9a359210aa
Cleanup named tuple subclassing example.
2008-01-07 20:07:38 +00:00
Vinay Sajip
aa0665ba17
Added section about adding contextual information to log output.
2008-01-07 19:40:10 +00:00
Georg Brandl
61d2886491
Fix two further doc build warnings.
2008-01-07 18:57:03 +00:00
Georg Brandl
62416bcf5a
#467924 , patch by Alan McIntyre: Add ZipFile.extract and ZipFile.extractall.
2008-01-07 18:47:44 +00:00
Georg Brandl
62647653eb
Restructure urllib doc structure.
2008-01-07 18:23:27 +00:00
Georg Brandl
2da0fceba7
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
2008-01-07 17:09:35 +00:00
Georg Brandl
b3255ed8c9
Restore "somenamedtuple" as the "class" for named tuple attrs.
2008-01-07 16:43:47 +00:00
Mark Summerfield
86dfee5c45
Added a hyperlink from sequence types to mutable sequence types.
2008-01-07 16:42:08 +00:00
Christian Heimes
fb2d25a154
Issue #1646 : Make socket support TIPC. The socket module now has support
...
for TIPC under Linux, see http://tipc.sf.net/ for more information.
Thanks to Alberto Bertogli for the patch
2008-01-07 16:12:44 +00:00
Vinay Sajip
e28fa297e9
Updated docs for basicConfig to indicate it's a no-op if handlers have been defined for the root logger.
2008-01-07 15:30:36 +00:00
Georg Brandl
503f2935c9
Clean up markup.
2008-01-07 09:18:17 +00:00
Georg Brandl
3c403b2370
Consistency nit.
2008-01-07 09:16:08 +00:00
Georg Brandl
66502c11e9
Change virtual class name of __iter__ to "object" in order to make it linkable.
2008-01-07 09:07:38 +00:00
Raymond Hettinger
dc55f35f38
Add another named tuple subclassing example.
2008-01-07 09:03:49 +00:00
Raymond Hettinger
1db6f80cd5
Cleanup subclassing example to more clearly show fixed-width print format.
2008-01-07 05:50:35 +00:00
Raymond Hettinger
b8e0072fec
Add subclassing example to docs for named tuples.
2008-01-07 04:24:49 +00:00
Georg Brandl
4273222a68
Remove latex trace.
2008-01-06 23:22:27 +00:00
Georg Brandl
27a2d1332b
Fix introductory sentence.
2008-01-06 17:21:00 +00:00
Georg Brandl
e260ba2d33
#1325 : Add docs and tests for zipimporter.archive and zipimporter.prefix.
2008-01-06 16:49:50 +00:00
Georg Brandl
516787dd98
#1499 : Document compile() exceptions.
2008-01-06 16:22:56 +00:00
Georg Brandl
81de0d24d5
#1582 : document __reversed__, patch by Mark Russell.
2008-01-06 16:17:56 +00:00
Georg Brandl
ec32b6bce7
#1559684 : document that shutil.copy* doesn't copy all metadata on Posix and Windows too.
2008-01-06 16:12:39 +00:00
Georg Brandl
14aaee143d
#1686390 : add example for csv.Sniffer use.
2008-01-06 16:04:56 +00:00
Georg Brandl
2cb103ffa9
#1727024 : document that Popen.returncode is set by Popen.poll/wait.
2008-01-06 16:01:26 +00:00
Georg Brandl
c4768a4a98
#1615275 : clarify return object types of different tempfile factories.
2008-01-06 15:55:26 +00:00
Georg Brandl
91a4808aa8
#759525 : document that dir() doesn't return metaclass attrs when given a class as arg.
2008-01-06 15:48:20 +00:00
Georg Brandl
db210dfba2
#1501 : document that 0**0 == 1.
2008-01-06 15:41:50 +00:00
Georg Brandl
a8cbad3b83
#1755097 : document default values for [].sort() and sorted().
2008-01-06 15:34:57 +00:00
Georg Brandl
437e15d42b
#1680 : fix context manager example function name.
2008-01-06 15:30:34 +00:00
Raymond Hettinger
1166872006
Small code simplification. Forgot that classmethods can be called from intances.
2008-01-06 09:02:24 +00:00
Georg Brandl
165010834a
#1719 : capitalization error in "UuidCreate".
2008-01-05 20:46:29 +00:00
Georg Brandl
2fa2f5d3e5
Revert socket.rst to unix-eol.
2008-01-05 20:29:13 +00:00
Georg Brandl
f725b9587c
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
2008-01-05 19:44:22 +00:00
Georg Brandl
9749e15e2f
Remove with_statement future imports from 2.6 docs.
2008-01-05 19:28:16 +00:00
Jeffrey Yasskin
9871d8fe22
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
...
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
2008-01-05 08:47:13 +00:00
Raymond Hettinger
1b50fd7cb3
Add error-checking to namedtuple's _replace() method.
2008-01-05 02:17:24 +00:00
Raymond Hettinger
02740f73ff
Improve namedtuple's _cast() method with a docstring, new name, and error-checking.
2008-01-05 01:35:43 +00:00
Andrew M. Kuchling
54966a5f94
Fix markup
2008-01-04 18:25:05 +00:00
Christian Heimes
04ae916fa2
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
2008-01-04 15:23:30 +00:00
Raymond Hettinger
e0734e7dc0
Minor fix-ups to named tuples:
...
* Make the _replace() method respect subclassing.
* Using property() to make _fields read-only wasn't a good idea.
It caused len(Point._fields) to fail.
* Add note to _cast() about length checking and alternative with the star-operator.
2008-01-04 03:22:53 +00:00
Andrew M. Kuchling
7ef1ce69d0
Markup fixes; grammar tweaks
2008-01-04 01:15:50 +00:00
Christian Heimes
eebb79cc69
Added copysign(x, y) function to the math module
2008-01-03 22:32:26 +00:00
Christian Heimes
e2ca4245c9
Added math.isinf() and math.isnan()
2008-01-03 20:23:15 +00:00
Jeffrey Yasskin
2f3c16be73
Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (just
...
the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361,
r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new
documentation. The only significant difference is that round(x) returns a float
to preserve backward-compatibility. See http://bugs.python.org/issue1689 .
2008-01-03 02:21:52 +00:00
Raymond Hettinger
81a885af05
Improve docs for itertools.groupby(). The use of xrange(0) to create a unique object is less obvious than object().
2007-12-29 22:16:24 +00:00
Raymond Hettinger
5d332bbdee
Simpler documentation for itertools.tee(). Should be backported.
2007-12-29 22:09:34 +00:00
Georg Brandl
b19be571e0
Some cleanup in the docs.
2007-12-29 10:57:00 +00:00
Guido van Rossum
02de8979cc
Patch #1583 by Adam Olsen.
...
This adds signal.set_wakeup_fd(fd) which sets a file descriptor to
which a zero byte will be written whenever a C exception handler runs.
I added a simple C API as well, PySignal_SetWakeupFd(fd).
2007-12-19 19:41:06 +00:00
Raymond Hettinger
85dfcf3530
Users demand iterable input for named tuples. The author capitulates.
2007-12-18 23:51:15 +00:00
Christian Heimes
0a8143f646
Applied patch #1635 : Float patch for inf and nan on Windows (and other platforms).
...
The patch unifies float("inf") and repr(float("inf")) on all platforms.
2007-12-18 23:22:54 +00:00
Raymond Hettinger
8777bcae27
Simplify and speedup _asdict() for named tuples.
2007-12-18 22:21:27 +00:00
Raymond Hettinger
88880b2dd6
Add more namedtuple() test cases. Neaten the code and comments.
2007-12-18 00:13:45 +00:00
Georg Brandl
1bd51e3eec
Remove curious space-like characters.
2007-12-16 16:00:36 +00:00
Georg Brandl
6dfe956bfc
Remove another unnecessary Unicode character.
2007-12-16 15:59:19 +00:00
Georg Brandl
459744cc71
Remove gratuitous unicode character.
2007-12-16 15:53:49 +00:00
Georg Brandl
05df69b2ea
Remove orphaned footnote reference.
2007-12-16 15:47:46 +00:00
Raymond Hettinger
e846f38c77
Add usage note
2007-12-14 21:51:50 +00:00
Raymond Hettinger
07ae83f840
Faster and simpler _replace() method
2007-12-14 19:19:59 +00:00
Raymond Hettinger
48eca67ab9
Add line spacing for readability
2007-12-14 18:08:20 +00:00
Raymond Hettinger
42da874cdd
Cleaner method naming convention
2007-12-14 02:49:47 +00:00
Raymond Hettinger
04a9a0e904
Simplify implementation of __replace__()
2007-12-13 22:55:52 +00:00
Christian Heimes
7c7f6afa92
Added wide char api variants of getch and putch to msvcrt module. The wide char methods are required to fix #1578 in py3k. I figured out that they might be useful in 2.6, too.
2007-12-10 15:12:41 +00:00
Brett Cannon
338d41850a
Use a versionchanged directive.
2007-12-09 05:09:37 +00:00
Skip Montanaro
546624609e
correct email address
2007-12-08 15:26:16 +00:00
Georg Brandl
e40a6a85ee
Add examples to the datetime documentation. Written for GHOP by "h4wk.cz".
2007-12-08 11:23:13 +00:00
Raymond Hettinger
ba9eea5aaa
Don't have the docs berate themselves. Keep a professional tone.
...
If a todo is needed, put it in the tracker.
2007-12-07 01:53:01 +00:00
Georg Brandl
d6b20dc54f
Better re.split examples.
2007-12-06 09:45:39 +00:00
Georg Brandl
2b92f6bab3
Diverse markup fixes.
2007-12-06 01:52:24 +00:00
Georg Brandl
b8df156ab5
Add examples to re docs. Written for GHOP by Dan Finnie.
2007-12-05 18:30:48 +00:00
Georg Brandl
722e1011c9
Add examples to csv, pprint and traceback docs.
...
Written by Ross for GHOP.
2007-12-05 17:56:50 +00:00
Georg Brandl
c37f288ec6
Add tutorial and examples to logging docs, from GHOP student "oscar8thegrouch".
2007-12-04 17:46:27 +00:00
Georg Brandl
0a0cf16de9
Add examples to the xmlrpclib docs.
...
Written for GHOP by Josip Dzolonga.
2007-12-03 20:03:46 +00:00
Christian Heimes
44eeaec173
Patch #1537 from Chad Austin
...
Change GeneratorExit's base class from Exception to BaseException
(This time I'm applying the patch to the correct sandbox.)
2007-12-03 20:01:02 +00:00
Martin v. Löwis
6b449f4f2b
Issue #1727780 : Support loading pickles of random.Random objects created
...
on 32-bit systems on 64-bit systems, and vice versa. As a consequence
of the change, Random pickles created by Python 2.6 cannot be loaded
in Python 2.5.
2007-12-03 19:20:02 +00:00
Georg Brandl
584265b001
Add more entries to the glossary.
...
Written by Jeff Wheeler for GHOP.
2007-12-02 14:58:50 +00:00
Georg Brandl
b15a8df519
Convert bdb.rst line endings to Unix style.
2007-12-02 14:37:29 +00:00
Georg Brandl
fefcd4ec40
Add example to mmap docs.
...
Written for GHOP by Rafal Rawicki.
2007-12-02 14:34:34 +00:00
Georg Brandl
87983f24cf
Add "Using Python on Windows" document, by Robert Lehmann.
...
Written for GHOP.
2007-12-01 23:12:45 +00:00
Georg Brandl
39bd059e42
Add examples to the ElementTree documentation.
...
Written by h4wk.cz for GHOP.
2007-12-01 22:42:46 +00:00
Christian Heimes
3e76d9346b
Added one more missing versionadded tag
2007-12-01 15:40:22 +00:00
Christian Heimes
dfdfaab1c5
Feature #1534
...
Added PyFloat_GetMax(), PyFloat_GetMin() and PyFloat_GetInfo() to the float API.
Added a dictionary sys.float_info with information about the internal floating point type to the sys module.
2007-12-01 11:20:10 +00:00
Georg Brandl
81ddc1a69b
Move lchmod() docs to correct place, and add versionadded tags.
2007-11-30 22:04:45 +00:00
Christian Heimes
3628187b66
Fix for feature request #1528 Add os.fchmod
...
Georg Brandl has added fchmod() and fchown(). I've contributed lchown but I'm not able to test it on Linux. However it should be available on Mac and some other flavors of Unix.
I've made a quick test of fchmod() and fchown() on my system. They are working as expected.
2007-11-30 21:11:28 +00:00
Georg Brandl
82225b7737
Add more examples to the wsgiref docs.
...
From GHOP by Josip Dzolonga.
2007-11-29 23:00:03 +00:00
Georg Brandl
430e3620b6
Add examples to the ConfigParser documentation.
...
Credits go to Thomas Lamb, who wrote this as a task in the GHOP contest.
2007-11-29 17:02:34 +00:00
Georg Brandl
9d83daa03d
Fix reference target.
2007-11-29 17:01:20 +00:00
Christian Heimes
d7b333779a
Added py3kwarning to the documentation of the sys module.
2007-11-28 08:02:36 +00:00
Christian Heimes
28104c58d2
Expose Py_Py3kWarningFlag as sys.py3kwarning as discussed in #1504
...
Also added a warning.warnpy3k() as convenient method for Python 3.x related deprecation warnings.
2007-11-27 23:16:44 +00:00
Martin v. Löwis
c8dfd588c2
Bug #1494 : Document that appendChild removes first.
2007-11-24 18:33:40 +00:00
Georg Brandl
b67da6ed2b
#1735632 : add O_NOATIME constant to os module.
...
Also document a few other O_ constants that were missing from documentation.
2007-11-24 13:56:09 +00:00
Georg Brandl
f8b6abd972
#1355 : remove mention of PyXML from xml.dom docs.
2007-11-24 11:42:14 +00:00
Georg Brandl
586edab279
#1467 : fix documentation for TestResult.add{Error,Failure}.
2007-11-24 11:39:13 +00:00
Georg Brandl
439f250c00
#1344 : document that you need to open std{in,out,err} with PIPE if you want
...
communicate() to work as described.
2007-11-24 11:31:46 +00:00
Facundo Batista
c0458830fb
Fixed detail in add_type() explanation (issue 1463).
2007-11-19 16:30:24 +00:00
Raymond Hettinger
8465ae8cea
Fix signature in example
2007-11-17 01:51:22 +00:00
Raymond Hettinger
bc693491eb
Add example for use cases requiring default values.
2007-11-15 22:39:34 +00:00
Raymond Hettinger
7c3738e11c
Example of multiple replacements.
2007-11-15 03:16:09 +00:00
Raymond Hettinger
213ae014db
Fixup example in docs.
2007-11-15 02:58:20 +00:00
Raymond Hettinger
5681cbce81
Small improvement to the implementation of __replace__().
2007-11-15 02:55:42 +00:00
Raymond Hettinger
eeeb9c4445
Accept Issac Morland's suggestion for __replace__ to allow multiple replacements
...
(suprisingly, this simplifies the signature, improves clarity, and is comparably fast).
Update the docs to reflect a previous change to the function name.
Add an example to the docs showing how to override the default __repr__ method.
2007-11-15 02:44:53 +00:00
Georg Brandl
b5b6f3c46e
Remove dead link from random docs.
2007-11-14 13:59:09 +00:00
Georg Brandl
07c19eaa20
Fix seealso link to sets docs. Do not merge to Py3k.
2007-11-09 12:31:43 +00:00
Raymond Hettinger
1760c8a017
Add set.isdisjoint()
2007-11-08 02:52:43 +00:00
Raymond Hettinger
12e94200c0
Fix marshal's incorrect handling of subclasses of builtin types (backport candidate).
2007-11-07 01:13:09 +00:00
Gregory P. Smith
e1ac4f1930
Fixes Issue 1385: The hmac module now computes the correct hmac when using
...
hashes with a block size other than 64 bytes (such as sha384 and sha512).
2007-11-06 00:19:03 +00:00
Mark Summerfield
91f9429bc3
Clarified the fact that you can have comments for individual archive
...
members even though comments to the archive itself aren't currently
supported.
2007-11-05 14:38:50 +00:00
Mark Summerfield
aea6e5913b
Added cross-references between the various archive file formats.
2007-11-05 09:22:48 +00:00
Georg Brandl
9c466baa01
Fix syntax for versionchanged markup.
2007-11-04 17:43:49 +00:00
Skip Montanaro
d469ff1e6a
Note change to get_dialect semantics in 2.5. Will backport to 2.5.
2007-11-04 15:56:52 +00:00
Georg Brandl
7c3e79f67f
Make "hashable" a glossary entry and clarify docs on __cmp__, __eq__ and __hash__.
...
I hope the concept of hashability is better understandable now.
Thanks to Tim Hatch for pointing out the flaws here.
2007-11-02 20:06:17 +00:00
Mark Summerfield
ac3d429edc
Added more file-handling related cross-references.
2007-11-02 08:24:59 +00:00
Georg Brandl
744b32a544
Fix markup glitch.
2007-11-01 20:37:02 +00:00
Georg Brandl
03b15c67ff
#1364 : os.lstat is available on Windows too, as an alias to os.stat.
2007-11-01 17:19:33 +00:00
Raymond Hettinger
405884cd62
Sets are marshalable.
2007-10-31 22:15:49 +00:00
Raymond Hettinger
84e26b6d5d
Clarify the reasons why pickle is almost always better than marshal
2007-10-31 21:57:58 +00:00
Georg Brandl
1a94ec2664
Bug #1287 : make os.environ.pop() work as expected.
2007-10-24 21:40:38 +00:00
Neal Norwitz
530042816c
Bug #1313 , fix typo (wrong variable name) in example.
2007-10-23 05:44:27 +00:00
Travis E. Oliphant
8feafab346
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
2007-10-23 02:40:56 +00:00
Georg Brandl
a739503881
Add :term:s for "new-style class".
2007-10-21 12:15:05 +00:00
Georg Brandl
e7a0990113
Add :term:s for iterator.
2007-10-21 12:10:28 +00:00
Georg Brandl
cf3fb25932
Add :term: for generators.
2007-10-21 10:52:38 +00:00