Skip to content

Commit 44621bf

Browse files
committed
Update name and demo docstring
1 parent e02da5c commit 44621bf

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def run_tests(self):
2121
setup(
2222
name=sortedcontainers.__title__,
2323
version=sortedcontainers.__version__,
24-
description='Python Sorted Container Types: SortedList, SortedDict, and SortedSet',
24+
description='Sorted Containers -- Sorted List, Sorted Dict, Sorted Set',
2525
long_description=readme,
2626
author='Grant Jenks',
2727
author_email='[email protected]',
@@ -38,7 +38,6 @@ def run_tests(self):
3838
'Natural Language :: English',
3939
'Programming Language :: Python',
4040
'Programming Language :: Python :: 2',
41-
'Programming Language :: Python :: 2.6',
4241
'Programming Language :: Python :: 2.7',
4342
'Programming Language :: Python :: 3',
4443
'Programming Language :: Python :: 3.2',

sortedcontainers/__init__.py

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
"""Sorted Container Types: SortedList, SortedDict, SortedSet
1+
"""Sorted Containers -- Sorted List, Sorted Dict, Sorted Set
22
3-
SortedContainers is an Apache2 licensed containers library, written in
3+
Sorted Containers is an Apache2 licensed containers library, written in
44
pure-Python, and fast as C-extensions.
55
6-
76
Python's standard library is great until you need a sorted collections
87
type. Many will attest that you can get really far without one, but the moment
98
you **really need** a sorted list, dict, or set, you're faced with a dozen
@@ -14,22 +13,31 @@
1413
1514
::
1615
17-
>>> from sortedcontainers import SortedList, SortedDict, SortedSet
18-
>>> sl = SortedList(range(10000000))
19-
>>> 1234567 in sl
20-
True
21-
>>> sl[7654321]
22-
7654321
23-
>>> sl.add(1234567)
24-
>>> sl.count(1234567)
16+
>>> from sortedcontainers import SortedList
17+
>>> sl = SortedList(['e', 'a', 'c', 'd', 'b'])
18+
>>> sl
19+
SortedList(['a', 'b', 'c', 'd', 'e'])
20+
>>> sl *= 10_000_000
21+
>>> sl.count('c')
22+
10000000
23+
>>> sl[-3:]
24+
['e', 'e', 'e']
25+
>>> from sortedcontainers import SortedDict
26+
>>> sd = SortedDict({'c': 3, 'a': 1, 'b': 2})
27+
>>> sd
28+
SortedDict({'a': 1, 'b': 2, 'c': 3})
29+
>>> sd.popitem(index=-1)
30+
('c', 3)
31+
>>> from sortedcontainers import SortedSet
32+
>>> ss = SortedSet('abracadabra')
33+
>>> ss
34+
SortedSet(['a', 'b', 'c', 'd', 'r'])
35+
>>> ss.bisect_left('c')
2536
2
26-
>>> sl *= 3
27-
>>> len(sl)
28-
30000003
2937
30-
SortedContainers takes all of the work out of Python sorted types - making your
31-
deployment and use of Python easy. There's no need to install a C compiler or
32-
pre-build and distribute custom extensions. Performance is a feature and
38+
Sorted Containers takes all of the work out of Python sorted types - making
39+
your deployment and use of Python easy. There's no need to install a C compiler
40+
or pre-build and distribute custom extensions. Performance is a feature and
3341
testing has 100% coverage with unit tests and hours of stress.
3442
3543
:copyright: (c) 2014-2018 by Grant Jenks.

0 commit comments

Comments
 (0)