Hi!
I decided to learn python! Is Processing.py a viable learning tool? How hard is it to switch from processing.py to normal python?
Is it recommended? Are there any resources for learning python? Could I use processing.py while watching python tutorials? Are there any differences? A friend recommended Caleb Curry (youtube) so would his tutorials help?
In my opinion (your mileage may vary) it is a viable path.
I have a few recommendations but knowing if you are already familiar with another programming language might help me calibrate better what to recommendâŚ
For a general (standard) Python intro for someone who has never programmed before I like to recommend: https://greenteapress.com/wp/think-python/
UPDATE: I have seen you profile this might be a bit too introductory for you. You might enjoy the other non-Processing resource automatheboringstuff.com
It is good that you are aware that there are some differences and peculiarities to learning âstandardâ Python (Python 3 usually the âCPython implementationâ). The main difference and peculiarity is that Processing Python mode is based on a particular Python 2 interpreter (called Jython) that can talk to Java and the Processing ecosystem of libraries, but you canât use most of the modern Python 3 libraries. You can read more about it here: https://py.processing.org/tutorials/python-jython-java/
I took a quick look over the code in the Caleb Curry Github repo, thatâs referenced in the descriptions of his Python videos. I assume the video tutorials follow the code in those files. Most of it should work fine in Processing.py.
There are some exceptions â the print() function wonât ordinarily accept an end argument, and floating-point division wonât automatically apply to integers. However, you can add the following two lines to the top of any Processing.py script to get those features working like Calebâs examples:
from __future__ import print_function
from __future__ import division
Additionally, add an object to the parentheses wherever you define a new class:
# this --
class Book():
# becomes this --
class Book(object):
Anything that uses Tkinter wonât work in Processing.py, but thatâs only relevant for one or two of the final lessons from what I can tell. Tkinter is a GUI library for Python, which I suspect wonât be all that useful to you. You can likely replicate that functionality with Processing GUI libraries (like controlP5, etc.)
In Python, functions begin with def. Block headers end with a colon. Code contents are defined by their indentation. So, when the indentation decreases, weâve left the code block.
For an example of a boolean expression, hereâs an if block header: