Naming collision between Processing `map()` and Python `map()`
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
Research direction
Start with the array example and the map() collision described in the issue, then compare the referenced processing.py dispatch in PAppletJythonDriver.java with py5's remap() API. Determine which naming or dispatch behavior libprocessing should adopt, and consider the Python built-in compatibility implications. Done means the chosen API resolves the example without ambiguity and is documented or tested accordingly.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Rust
- Stars
- 69
- Forks
- 14
- Avg merge
- 15d 22h
- Merged PRs (30d)
- 3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from processing/libprocessing
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
processing/libprocessing#233 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
processing/libprocessing#229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
processing/libprocessing#201 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
processing/libprocessing#194 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
processing/libprocessing#146 · 1 comment ·
All issues in processing/libprocessing
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
bug rules
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
app bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
IronCoreLabs/ironcore-alloy#346 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100