Name | pyabstractdatatype JSON |
Version |
0.0.2
JSON |
| download |
home_page | |
Summary | Abstract Data Types for Python |
upload_time | 2022-12-17 18:18:27 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.7 |
license | |
keywords |
adt
data structure
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# PyAbstractDataType
A simple library that adds [ADTs](https://en.wikipedia.org/wiki/Abstract_data_type) to Python.
[Source Code](https://github.com/angelcaru/pyabstractdatatype/)
## Documentation
Basic usage:
```python
from adt import adt
@adt
class MyADT:
Variant1: (int, int)
Variant2: (int)
Variant3: (str, str, list[float])
```
Supports `match` statement!
```python
obj1 = MyADT.Variant1(2, 2)
obj2 = MyADT.Variant3("hi", "foo", [2.3, 5.6, 3.1415])
objs = obj1, obj2
for obj in objs:
match obj1:
case MyADT.Variant1(a, b):
print(f"Found you! {a}, {b}")
case MyADT.Variant2(x):
print(":(")
case _:
raise ValueError("wtf")
```
Output:
```python
Found you! 2, 2
Traceback (most recent call last):
...
ValueError: wtf
```
## Examples
See [example.py](https://github.com/angelcaru/pyabstractdatatype/blob/main/example.py).
Raw data
{
"_id": null,
"home_page": "",
"name": "pyabstractdatatype",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "\u00c1ngel Carvajal Ruiz <angelcaru10+pyadt@gmail.com>",
"keywords": "adt,data structure",
"author": "",
"author_email": "\u00c1ngel Carvajal Ruiz <angelcaru10+pyadt@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c1/82/54b66c3dfe7c25a91e38a1c5012cee10b212597e5d77f2353b21189122c4/pyabstractdatatype-0.0.2.tar.gz",
"platform": null,
"description": "# PyAbstractDataType\nA simple library that adds [ADTs](https://en.wikipedia.org/wiki/Abstract_data_type) to Python.\n\n[Source Code](https://github.com/angelcaru/pyabstractdatatype/)\n\n## Documentation\nBasic usage:\n```python\nfrom adt import adt\n\n@adt\nclass MyADT:\n Variant1: (int, int)\n Variant2: (int)\n Variant3: (str, str, list[float])\n```\n\nSupports `match` statement!\n```python\nobj1 = MyADT.Variant1(2, 2)\nobj2 = MyADT.Variant3(\"hi\", \"foo\", [2.3, 5.6, 3.1415])\n\nobjs = obj1, obj2\n\nfor obj in objs:\n match obj1:\n case MyADT.Variant1(a, b):\n print(f\"Found you! {a}, {b}\")\n case MyADT.Variant2(x):\n print(\":(\")\n case _:\n raise ValueError(\"wtf\")\n```\n\nOutput:\n```python\nFound you! 2, 2\nTraceback (most recent call last):\n...\nValueError: wtf\n```\n\n## Examples\nSee [example.py](https://github.com/angelcaru/pyabstractdatatype/blob/main/example.py).\n",
"bugtrack_url": null,
"license": "",
"summary": "Abstract Data Types for Python",
"version": "0.0.2",
"split_keywords": [
"adt",
"data structure"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d9fc01fe95a891743bbf1b3ac34c77f3",
"sha256": "d46de2f30a8d3840e8733277eaad34908613b1f30eb1c015e1f6c603c917ebf6"
},
"downloads": -1,
"filename": "pyabstractdatatype-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d9fc01fe95a891743bbf1b3ac34c77f3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 3902,
"upload_time": "2022-12-17T18:18:25",
"upload_time_iso_8601": "2022-12-17T18:18:25.983496Z",
"url": "https://files.pythonhosted.org/packages/ac/3e/2d535feb04bfc2d0bcd28fc1b7f9abeccfbc9617fe0ba743c0880a1344bf/pyabstractdatatype-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "69c9904176ed862e0cd9873527d98b38",
"sha256": "b74f2b567c194fbd07892919e89e109f11d7495eb0457140bb721b306dece587"
},
"downloads": -1,
"filename": "pyabstractdatatype-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "69c9904176ed862e0cd9873527d98b38",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 3457,
"upload_time": "2022-12-17T18:18:27",
"upload_time_iso_8601": "2022-12-17T18:18:27.769719Z",
"url": "https://files.pythonhosted.org/packages/c1/82/54b66c3dfe7c25a91e38a1c5012cee10b212597e5d77f2353b21189122c4/pyabstractdatatype-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-17 18:18:27",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "pyabstractdatatype"
}