Skip to main content

Limited Ordered Set object. Data type for storing actions history lists.

Project description

Version 0.1.0

Limited Ordered Set

Data type for storing sorted list of objects with sort order and list length limit. Useful for storing data like history of user interactions on site.

Once added object to list overflow set length, it pop items from set beginning of set. You always have only last X entries limited b length property.

Installation

You can simple install library with pip install limited-ordered-set.

Example

You can add as many as you want objects to LimitedOrderedSet, it will pop first items once items count hit limit.

For example you can go to tests.:

limit = 10
objcts = LimitedOrderedSet(limit)

print 'Adding chars: ',
for x in xrange(0, 50):
    c = choice(string.ascii_letters)
    print c,
    objcts.add(c)
print

print 'Resulting set items: %s' % ",".join(objcts)

Execution result

Adding chars: B Z V N F k j j o v t M k j P v A Y O h E v f A g e F T Q b f r j t W q r C C S m P V m o B z a L w

Resulting set items: S,m,P,V,o,B,z,a,L,w

Contribution

You always are welcome if you have any ideas. You can push request at github project page.

https://github.com/phpdude/limited-ordered-set

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

limited-ordered-set-0.1.0.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file limited-ordered-set-0.1.0.tar.gz.

File metadata

File hashes

Hashes for limited-ordered-set-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ec40f1298d569ee705368e9c0531e8aecd55dbfeeca0c0e9ccb65da0faf10955
MD5 e059404f55d78f58fd0aa0ffe6e546ec
BLAKE2b-256 319b881640b952bdef5203a77d23ac113ac0d69f5c5b54ffe60c2700bdc6d0ec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page