Skip to main content
PyPI Package latest release PyPI Package monthly downloads Supported versions Supported implementations Wheel packaging support Test line coverage

Attribute-accesible collections inspired by stuf. Implements chainstuf and counterstuf: versions of ChainMap and Counter that expose their keys as attributes.

The ultimate goal of this module is to have these functions available in the stuf module, and this sidecar to be retired.

Usage

Use these just like you would ChainMap and Counter, except that you get attribute-style access as well.

For chainstuf:

from otherstuf import chainstuf

d1 = dict(this=1, that=2)
d2 = dict(roger=99, that=100)

# test simple attribute equivalence
c = chainstuf(d1, d2)

assert c.this == 1
assert c.roger == 99

c.roger = 'wilco'
assert c.roger
print "roger", c.roger

d1.update(feeling='fancypants!')
print "i'm feeling", c.feeling     # passed through, since d2 lacks 'feeling'

Given recent versions (e.g. beyond 0.9.10) of stuf, one could simply use from stuf import chainstuf. This portion of the otherstuf sidecar is now superfluous.

For counterstuf:

from otherstuf import counterstuf

c = counterstuf()
c.update("this and this is this but that isn't this".split())
c.total = sum(c.values())

print "everything:", c.total
print "'this' mentioned", c.this, "times"
print "'bozo' mentioned", c.bozo, "times"
print c

Notes

  • Version 1.1.0 initates automated test coverage metrics. Test coverage started at 88%. Cleanups got coverage to 100%. Hooah!

  • Automated multi-version testing managed with pytest, pytest-cov, coverage and tox. Packaging linting with pyroma.

    Successfully packaged for, and tested against, all late-model versions of Python: 2.6, 2.7, 3.2, 3.3, 3.4, and 3.5 pre-release (3.5.0b3) as well as PyPy 2.6.0 (based on 2.7.9) and PyPy3 2.4.0 (based on 3.2.5). Test line coverage 100%.

  • As of 1.0.0, updated to use semantic versioning and the Apache Software License.

  • Recent builds of stuf have left Python 2.6 out in the cold. This package requires stuf==0.9.14 for 2.6–the last version to successfully install there. Newer Python releases will get stuf>=0.9.16. I’ve submitted a patch for 2.6 installability to carry forward; we’ll have to see where that goes.

  • The author, Jonathan Eunice or @jeunice on Twitter welcomes your comments and suggestions.

Installation

To install or upgrade to the latest version:

pip install -U otherstuf

To easy_install under a specific Python version (3.3 in this example):

python3.3 -m easy_install --upgrade otherstuf

(You may need to prefix these with sudo to authorize installation. In environments without super-user privileges, you may want to use pip’s --user option, to install only for a single user, rather than system-wide.)

Metadata

Release files for otherstuf 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distributions (sdists)

Source distribution for otherstuf 1.1.0
File Size Uploaded
otherstuf-1.1.0.zip 11.1 kB Details
otherstuf-1.1.0.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for otherstuf 1.1.0
File Interpreter ABI Platform
otherstuf-1.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 23.6 kB

Release files / otherstuf-1.1.0.zip

Download URL otherstuf-1.1.0.zip
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4e404ba157b54dd31a30e3d9499c3122698847f50f1343d3b203cadeab99ec07
BLAKE2b-256 checksum
How to use checksums
17e0ce2808e685e7f8c0184388c1b972429459a00624d73ad6a85e9068d96369
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / otherstuf-1.1.0.tar.gz

Download URL otherstuf-1.1.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7722980c3b58845645da2acc838f49a1998c8a6bdbdbb1ba30bcde0b085c4f4c
BLAKE2b-256 checksum
How to use checksums
4fb5fe92e1d92610449f001e04dd9bf7dc13b8e99e5ef8859d2da61a99fc8445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / otherstuf-1.1.0-py2.py3-none-any.whl

Download URL otherstuf-1.1.0-py2.py3-none-any.whl
Size 7.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
772bbaef5c5d276079446f92face7b5524ec2f4c86107ed825b4e52bc0cd151e
BLAKE2b-256 checksum
How to use checksums
fc13a5cd032c37e9f86accab034b384e5c2be507ae335ef452228f0a39d6b762
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.0 This release

3 release files

1.0.1

3 release files

1.0.0

3 release files

0.902

2 release files

0.803

2 release files

0.802

2 release files

0.704

2 release files

0.702

2 release files

0.651

2 release files

0.604

2 release files

0.509

2 release files

0.507

2 release files

0.503

2 release files

0.502

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page