processing / processing/libprocessing
Naming collision between Processing `map()` and Python `map()`
还没有人认领这个 Issue。
- 主要语言
- Rust
- 星标
- 69
- 派生
- 14
- 平均合并
- 15 天 22 小时
- 30 天内合并 PR
- 3
描述
Trying to port the array example (See issue: Port Basics / Arrays / Array #3) and I'm running into this error:
coswave = [abs(cos(map(i, 0, width, 0, pi))) for i in range(width)]
~~~^^^^^^^^^^^^^^^^^^^^
TypeError: 'int' object is not iterable
I suppose this is because Python has its own map() function (a list transformation) different from the map() function in Processing (a linear interpolation function).
Processing.py handles this by wrapping map() and dispatching based on the arguments (see source code). It uses the Processing version when called with five numeric arguments, and otherwise falls back to Python’s built-in. Note: the same approach is used for filter().
By contrast, py5 avoids the conflict by renaming the function to remap() instead.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中描述的数组示例和 map() 冲突出发,然后将 PAppletJythonDriver.java 中所引用的 processing.py dispatch 与 py5 的 remap() API 进行比较。确定 libprocessing 应采用哪种命名或 dispatch 行为,并考虑其对 Python 内置函数兼容性的影响。当所选 API 能够无歧义地解决该示例,并且已相应地完成文档编写或测试时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python, rust
- 领域
- api
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100