You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
setup function is not meaningful, the same results can be achieved just without. Using setup to initialize variables etc. causes even more undefined issues because how scopes work in Python.
As an alternative, a class based approach can solve all these issues:
No more magic imports, no more undefined variables, and now the sketch has a Python-native syntax feel much more natural comparing to the previous version.
I removed the setter function calls too, it's a Java-native pattern and feels weird with Python.
We can go one step further and eliminate the setup() What does it do for the sketch can be covered by __init__ in a class context.
I am not involved in this particular project in any direct way, just watching out of curiousity and would be happy to try it out at some point. But in my opinion, as primarily a python coder since ~2018, I personally prefer the original sketch. The reason I would use this for art would be with the express purpose of bringing in Processing/p5 patterns and making them available within python. Processing/p5 libraries do have patterns between them that sometimes diverge intentionally from the host languages, and, for me, that is a benefit.
To be frank, the original code and setup/draw structure feels familiar to me too but they don't work with Python / Python tooling. mewnala already does some behind-the-scene operations to inject variables like height - width, and the overall approach with setup() doesn't match how scopes work in Python - requires even more custom operations.
Processing/p5 libraries do have patterns between them
I support the intention here, but I'm not sure it's the case. With the "class mode"-ish alternative I recommend, we would still have the setup / draw structures and the same concept of sketch - so no lost on Processing/p5 patterns. The difference would be that those patterns will be implemented using Python-native approaches and will work fine with Python; instead of using Java-native patterns that are not supported by Python tooling.
sometimes diverge intentionally from the host languages, and, for me, that is a benefit.
I'm missing the benefit with the examples above. Python is a powerful language/ecosystem, and creating broken Python code that works only with a very specific tooling is a significant loss IMO. If we want p5/Processing people to use the patterns they already know, in other languages, "class mode" already provides it but with an important extra: Python devs can start using Processing, while using the best practices of the language they already know. Otherwise, we are limited with Java-native patterns that is not known and/or used by Python people, and a very limited tooling. My honest take here is that this limitation defies the purpose.
Activity
[-]Python sketches are not Pythonci[/-][+]Python sketches are not Pythonic[/+]ksen0 commentedon Aug 14, 2026
I am not involved in this particular project in any direct way, just watching out of curiousity and would be happy to try it out at some point. But in my opinion, as primarily a python coder since ~2018, I personally prefer the original sketch. The reason I would use this for art would be with the express purpose of bringing in Processing/p5 patterns and making them available within python. Processing/p5 libraries do have patterns between them that sometimes diverge intentionally from the host languages, and, for me, that is a benefit.
ulgens commentedon Aug 14, 2026
To be frank, the original code and setup/draw structure feels familiar to me too but they don't work with Python / Python tooling. mewnala already does some behind-the-scene operations to inject variables like height - width, and the overall approach with setup() doesn't match how scopes work in Python - requires even more custom operations.
Another example I can use to summarize the problem is https://py5coding.org/content/py5_modes.html#imported-mode vs https://py5coding.org/content/py5_modes.html#class-mode . Right now, mewnala sketches follow "imported mode". To be able to edit a "imported mode" sketch with VSCode or Pycharm and have a decent experience, the IDEs need a plugin. class mode works just fine regardless of the tooling.
I support the intention here, but I'm not sure it's the case. With the "class mode"-ish alternative I recommend, we would still have the setup / draw structures and the same concept of sketch - so no lost on Processing/p5 patterns. The difference would be that those patterns will be implemented using Python-native approaches and will work fine with Python; instead of using Java-native patterns that are not supported by Python tooling.
I'm missing the benefit with the examples above. Python is a powerful language/ecosystem, and creating broken Python code that works only with a very specific tooling is a significant loss IMO. If we want p5/Processing people to use the patterns they already know, in other languages, "class mode" already provides it but with an important extra: Python devs can start using Processing, while using the best practices of the language they already know. Otherwise, we are limited with Java-native patterns that is not known and/or used by Python people, and a very limited tooling. My honest take here is that this limitation defies the purpose.
Convert unit 02 sketches to "class mode"
Convert unit 02 sketches to "class mode"