alistpy-1.2.0
توضیحات
An Association List construct
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | alistpy-1.2.0 |
| نام | alistpy |
| نسخه کتابخانه | 1.2.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | James Milne |
| ایمیل نویسنده | james.milne@protonmail.com |
| آدرس صفحه اصلی | https://git.sr.ht/~shakna/alistpy |
| آدرس اینترنتی | https://pypi.org/project/alistpy/ |
| مجوز | - |
# alistpy
An Association List construct for Python
---
## Install
```pip install alistpy```
---
## Usage
This simple library provides an AList object that should be a drop-in replacement for most dictionaries, but based on immutable data structures instead.
Cheap to construct, expensive to mutate, as it isn't mutable. Every mutative method actually generates a new AList in it's place.
Example:
```
import alist
# This is cheap:
a = alist.AList(x=0,y=1)
# This is also cheap:
print(a['x'])
# This is expensive:
a['x'] = 12
```
---
## Differences to Dictionaries
There's primarily two differences:
* Mutating the AList is expensive, rather than cheap.
* Setting the same key multiple times at init time is a ValueError.
That is, Python is happy with:
```
{'x': 0, 'x': 4}
> {'x': 4}
```
That sort of behaviour might be unexpected, or cause unexpected problems for the programmer.
So, instead alist:
```
alist.AList(x=0, x=4)
> Exception raised, ValueError
```
---
## Issues
[Issue tracker](https://todo.sr.ht/%7Eshakna/alistpy).
Anonymous users (those without accounts) are welcome to submit issues.
---
## Explicit API
There isn't one yet.
Check back in future versions. For now, be guided by the [tests](https://git.sr.ht/%7Eshakna/alistpy/tree/master/test_alist.py).
---
## Testing
Install ```pytest```, and then run it.
Currently 31 tests for 21 methods.
---
## License
BSD-3 Clause. See [LICENSE.md](https://git.sr.ht/~shakna/alistpy/tree/master/LICENSE.md) for more.
نحوه نصب
نصب پکیج whl alistpy-1.2.0:
pip install alistpy-1.2.0.whl
نصب پکیج tar.gz alistpy-1.2.0:
pip install alistpy-1.2.0.tar.gz