Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Data structure for complexe enumeration.

Project description

# Python Catalog

Data structure for storing complex enumeration

```python
class Color(Catalog):
_attrs = 'value', 'label', 'other'
red = 1, 'Red', 'stuff'
blue = 2, 'Blue', 'things'
```

Access values as Attributes

```python
>> Color.red.value
<< 1
>> Color.red.label
<< 'Red'
```

Call to look up members by attribute value

```python
>> Color('Blue', 'label')
<< Color.blue
```

Calling without attribute specified assumes first attribute defined in `_attrs`

```python
>> Color(1)
<< Color.red
```

`_attrs` defaults to `['value']`.

Member class can be replaced by extending `CatalogMember` and defining on Catalog with
the `_member_class` attribute

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pycatalog-1.1.0.tar.gz (2.7 kB) Copy SHA256 hash SHA256 Source None Nov 23, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page