Commit Graph

77 Commits

Author SHA1 Message Date
Raymond Hettinger 196a0f7a8a Fix typos. 2009-01-20 12:59:36 +00:00
Raymond Hettinger 230dd27628 Don't disrupt automatic url target name generation
with manually specified, conflicting names.

Before:
    http://docs.python.org/dev/library/collections.html#id1

After:
    http://docs.python.org/dev/library/collections.html#counter-objects
2009-01-20 07:11:47 +00:00
Raymond Hettinger bad1eb2ff3 Build-outs for Counter() class:
* Constructor and update() support keyword args (like their dict counterparts).
* The 'del' statement no longer raises KeyError for missing values.
* Add multiset operations:  __add__, __sub__, __and__, __or__.
2009-01-20 01:19:26 +00:00
Raymond Hettinger 2950bca89c Fix-up indentation of sample code blocks for namedtuple mthod definitions. 2009-01-14 01:39:51 +00:00
Raymond Hettinger 59894127e4 Minor doc tweaks. 2009-01-14 00:15:21 +00:00
Raymond Hettinger fbcf749479 Add table of idioms/patterns for using Counter objects.
Improve the appearance and flow of the References section -- it used
to have a box around it that wasn't distinct from the preceding code
boxes and it had a weird bolding pattern and hanging indents that
made the section disproportionately large.
2009-01-13 08:38:14 +00:00
Raymond Hettinger 8278385a05 Minor documentation tweaks and simpler update() example. 2009-01-13 03:49:43 +00:00
Raymond Hettinger aaa6e630f8 Simplify Counter() API. Replace items keyword argument
with a mapping.  Makes Counter() idempotent, makes update()
API the same as Counter.__init__(), makes a more readable
repr, makes the API more dict-like, and allows Steven
Bethard's update() example to work.
2009-01-13 01:05:03 +00:00
Raymond Hettinger f94d7fa5fb Issue 1696199: Add collections.Counter(). 2009-01-12 22:58:41 +00:00
Georg Brandl 7044b11818 Remove tabs from the documentation. 2009-01-03 21:04:55 +00:00
Georg Brandl c62ef8b4d9 Remove trailing whitespace. 2009-01-03 20:55:06 +00:00
Georg Brandl df9bcf1196 Fix typo. 2008-11-24 16:16:07 +00:00
Georg Brandl 061d2e2ee9 #4392: fix parameter name. 2008-11-23 19:17:25 +00:00
Benjamin Peterson 5c4e006367 document that deque indexing is O(n) #4123 2008-10-16 18:52:14 +00:00
Skip Montanaro b40890db07 usage 2008-09-17 11:50:36 +00:00
Georg Brandl dbc5987e2f Add missing ABCs to list. 2008-07-08 07:05:23 +00:00
Raymond Hettinger ee51cffc95 Fix whitespace in example code. 2008-06-27 21:34:24 +00:00
Raymond Hettinger e98839a1f4 Issue3065: Fixed pickling of named tuples. Added tests. 2008-06-09 01:28:30 +00:00
Raymond Hettinger 96b424062b Fix typo 2008-05-23 17:34:34 +00:00
Raymond Hettinger 5a9fed75bd Fix-up the enumerate type example and move it to the end. 2008-05-08 07:23:30 +00:00
Benjamin Peterson c7b05920d6 reformat some documentation of classes so methods and attributes are under the class directive 2008-04-25 01:29:10 +00:00
Georg Brandl d289ea6df9 #2502: add example how to do enum types with named tuples. 2008-03-28 12:58:26 +00:00
Georg Brandl 4c8bbe69e5 Make collections' doctests executable.
(The <BLANKLINE>s will be stripped from presentation output.)
2008-03-22 21:06:20 +00:00
Georg Brandl 907a720f89 A lot more typo fixes by Ori Avtalion. 2008-02-22 12:31:45 +00:00
Raymond Hettinger bc4ffc17df Backport ABC docs 2008-02-11 23:38:00 +00:00
Raymond Hettinger 9bba7b7085 Removed an unnecessary and confusing paragraph from the namedtuple docs. 2008-01-27 10:47:55 +00:00
Raymond Hettinger 0fe6ca4673 Better variable name in an example. 2008-01-18 21:14:58 +00:00
Raymond Hettinger 171f3916c5 Minor wordsmithing. 2008-01-16 23:38:16 +00:00
Raymond Hettinger e805782b53 Fix-up half-written paragraph in the docs 2008-01-15 21:22:47 +00:00
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
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
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
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
Georg Brandl b3255ed8c9 Restore "somenamedtuple" as the "class" for named tuple attrs. 2008-01-07 16:43:47 +00:00
Georg Brandl 503f2935c9 Clean up markup. 2008-01-07 09:18:17 +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
Raymond Hettinger 1166872006 Small code simplification. Forgot that classmethods can be called from intances. 2008-01-06 09:02:24 +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
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