Metadata-Version: 2.5
Name: a-a-a-a-a
Version: 0.0.3
Summary: Flatten nested iterables to a chosen depth.
Project-URL: Homepage, https://pypi.org/project/a-a-a-a-a/
Author-email: lqxnjk <lqxnjk@qq.com>
License: MIT
License-File: LICENSE
Keywords: depth,flatten,iterable,list,nested
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# a-a-a-a-a

[English](#english) | 中文

展开任意层级的嵌套列表、元组、集合与字典，可限深度。

## 安装

```console
pip install a-a-a-a-a
```

## 用法

```python
from a_a_a_a_a import flatten, flatten_iter

flatten([1, [2, [3, [4]]]])       # [1, 2, 3, 4]
flatten([1, [2, [3, [4]]]], 2)    # [1, 2, 3, [4]]
flatten(["ab", ["cd"]])           # ['ab', 'cd']
flatten([{"a": 1}, [2]])          # [1, 2]
list(flatten_iter([1, [2]]))      # [1, 2]
```

## 说明

字符串和字节**视为叶子**，永不拆成单字符；dict 按 value 展开；`n_depth` 为空表示全展开，`1` 只拆一层。提供 `flatten_iter` 流式版本，深长输入不会一次性materialize。

## 许可证

MIT

---

<a id="english"></a>
## English

Flatten nested iterables to a chosen depth.

## Install

```console
pip install a-a-a-a-a
```

## Usage

```python
from a_a_a_a_a import flatten, flatten_iter

flatten([1, [2, [3, [4]]]])       # [1, 2, 3, 4]
flatten([1, [2, [3, [4]]]], 2)    # [1, 2, 3, [4]]
flatten(["ab", ["cd"]])           # ['ab', 'cd']
flatten([{"a": 1}, [2]])          # [1, 2]
list(flatten_iter([1, [2]]))      # [1, 2]
```

## Notes

Strings and bytes are leaves and are never split into characters. Dicts descend into their values. `n_depth=None` unwraps fully, `1` unwraps one level. `flatten_iter` streams instead of materializing.

## License

MIT
