Skip to content

Commit

Permalink
improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jab committed Nov 29, 2015
1 parent 4446d57 commit 2089b7b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 29 deletions.
24 changes: 9 additions & 15 deletions docs/cut.rst → docs/addendum.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Not Worth Reading?
==================

This whole page should maybe just get cut from the docs.
Addendum
========

Missing bidicts in Stdlib!
--------------------------
Expand Down Expand Up @@ -61,12 +59,12 @@ Other Verbiage, Esoterica, Navel Gazing, &c.
or even "forward keys" and "inverse keys", respectively.
bidict sticks with the terms "keys" and "values"
for the sake of familiarity and to avoid potential confusion,
but it's worth noting that technically values are also keys themselves.
but technically values are also keys themselves.

Concretely, this allows us to return a set-like ``dict_keys`` object
for :attr:`bidict.BidirectionalMapping.values` (Python 3) /
:attr:`bidict.BidirectionalMapping.viewvalues` (Python 2),
rather than a (non-set-like) ``dict_values`` object.
Concretely, this allows bidict to return a set-like (``dict_keys``) object
for :attr:`bidict.values <bidict.BidirectionalMapping.values>` (Python 3) /
:attr:`bidict.viewvalues <bidict.BidirectionalMapping.viewvalues>`
(Python 2.7), rather than a non-set-like ``dict_values`` object.

- A bidict ``b`` keeps a reference to its inverse ``b.inv``.
By extension, its inverse bidict keeps a reference to it (``b.inv.inv is b``).
Expand All @@ -76,12 +74,8 @@ Other Verbiage, Esoterica, Navel Gazing, &c.
Python's garbage collector will detect this
and reclaim the memory allocated for a bidict
when you no longer have any references to it.
In other words, bidict won't leak memory
as long as you don't ``gc.disable()``.
If you do, reclaiming a bidict's memory is up to you,
but if you're disabling GC you knew that already.

**NOTE:** Prior to Python 3.4,
``__del__()`` methods prevented reference cycles from being garbage collected.
No bidicts define ``__del__()``,
so this is only an issue if you define ``__del__()`` in a bidict subclass.
No bidicts implement ``__del__()``,
so this is only an issue if you implement ``__del__()`` in a bidict subclass.
12 changes: 0 additions & 12 deletions docs/credits.rst

This file was deleted.

4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ and related functionality.
inverted.doctest
api
changelog
credits
cut
thanks
addendum
22 changes: 22 additions & 0 deletions docs/thanks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Thanks
------

- Thanks to Gregory Ewing for the name.

- Thanks to Terry Reedy for suggesting the slice syntax
(it was fun while it lasted).

- Thanks to Raymond Hettinger for suggesting namedbidict
and pointing out various caveats.

- Thanks to Francis Carr for the idea of storing the inverse bidict.

- Thanks to Brianna Laugher and Adopt Pytest Month for choosing bidict
as one of Adopt Pytest Month 2015's selected projects.

- Thanks to Tom Viner for all the help as bidict's mentor
during Adopt Pytest Month 2015.

- Thanks to the Pytest team and to David MacIver for the great testing tools.

- Thanks to Daniel Pope for various suggestions enhancing bidict's Python zen.

This comment has been minimized.

Copy link
@jab

jab Nov 29, 2015

Author Owner

@lordmauve Wanted to credit you here. Can rewrite the commit if you prefer I didn't.

0 comments on commit 2089b7b

Please sign in to comment.