processing / processing/libprocessing

Naming collision between Processing `map()` and Python `map()`

オープン
#131 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Rust
スター
69
フォーク
14
平均マージ
15日 22時間
マージ済み PR(30日)
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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、issue で説明されている配列の例と map() の衝突から始め、PAppletJythonDriver.java における参照されている processing.py のディスパッチを py5 の remap() API と比較してください。libprocessing が採用すべき命名またはディスパッチの挙動を判断し、Python 組み込みとの互換性への影響を検討してください。選択した API が例を曖昧さなく解決し、それに応じて文書化またはテストされていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, rust
領域
api
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。