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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pycatalog-1.1.0.tar.gz
(2.7 kB
view details)
File details
Details for the file pycatalog-1.1.0.tar.gz
.
File metadata
- Download URL: pycatalog-1.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e959220fd61d298b8742af984bbf05c181d5736beff11e08bbbd05902b0291d3 |
|
MD5 | 914965a47b49b708dec32f7f6aaccd5b |
|
BLAKE2b-256 | 8c5f8b4f36d2148c798f7ae20a48ff7b2698de4dc90891263a6f1738ed3920e9 |