dry-python / dry-python/lambdas

Prevent Python from treating _Callable an iterable

未关闭
#116 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
286
派生
6
PR 合并指标
30 天内没有已合并 PR

描述

## Problem
Due to lack of `__iter__` implementation, Python is attempting to iterate over `_Callable` when possible. It's generally an undesired behavior, given the purposes of the `_Callable` class.

You can easily reproduce the issue:
```python
[*__import__("lambdas")._]
```

## Implementation

That should be a no-brainer to fix and write tests for.

```
class _Callable:
__iter__ = None
```

贡献指南

打开贡献指南

调研方向

在 package 中定位 _Callable 类,并使用 [*__import__("lambdas")._] 重现该问题。添加所请求的不可迭代行为,以及一个回归测试,确认 _Callable 不会被视为 iterable。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
tooling
Issue 类型
缺陷
难度
1/5
预计耗时
1 小时以内
活跃度
停滞
描述清晰度
描述清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。