Python
rjo__
Posts: 2,114
in Propeller 2
To be honest, since Apple dropped support of Pascal, I have hated all computer languages... but the one I hate the least is Python.
I was happy to see interest in Python raised early and often and that there is now a serious effort to get uPython implemented.
I hope that it gets full support from everyone.
But...
What I like most about Python might not be what uPython on a P2 is able to offer... and that is a HUGE base of supporting modules.
1. Would it be possible to put true Python on a system that had multiple P2's and gobs of memory? If possible...how much more difficult would it be than say...uPython to impement?
2. If it is possible, would standard modules be available without having to recompile or reconfigure them in some way?
Thanks,
Rich
I was happy to see interest in Python raised early and often and that there is now a serious effort to get uPython implemented.
I hope that it gets full support from everyone.
But...
What I like most about Python might not be what uPython on a P2 is able to offer... and that is a HUGE base of supporting modules.
1. Would it be possible to put true Python on a system that had multiple P2's and gobs of memory? If possible...how much more difficult would it be than say...uPython to impement?
2. If it is possible, would standard modules be available without having to recompile or reconfigure them in some way?
Thanks,
Rich
Comments
Anything is possible, but why would anyone want to is a better question.
Before someone deploys "multiple P2's and gobs of memory", purely to run Python, they will more likely reach for a RaspPi Zero.
or, if they need more grunt, they may reach for something like this
https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-nano/
uPython seems to be running already in alpha form, on P2, and part of the appeal there is easy access to the Smart Pins.
It's not clear what you call 'true Python' would add ?
Do you mean 'standard modules' in the hardware or software sense ?
Any code that connects to hardware, is going to be non-portable by nature, but higher level code can be more portable.
It's likely to be more practical use getting a P2 to talk to (eg) a Nvidia jetson-nano, than it is to add multiple P2's to try to improve uPython performance.
Modern Basic dialects are quite close to Pascal, and Project Oberon may well run on a P2.
packages installed (about 200).
I work for a company that ships a homegrown Linux distribution. We recently added Python 2.7 to our firmware and were able to squeeze it down to about 20 MB I think. That required removing a few things we deemed "non essential" (though I don't remember what all was removed, I think the .pyc and .pyo files, all documentation, and maybe a few libraries were included in that).
Indeed - getting full-blown Python running on P2 seems a waste of time. If you need that kind of power, use a Pi.
Very very soon... we're well aware lol
https://pythonclock.org/
That doesn't mean you won't find it in the world. I work for a cyber-security company and we're required to know both because not everybody will pay to have legacy code upgraded.
To use it:
I designate a PNut P2 file in the script and then manually open it in Notepad++… after that I can run PNut with an F5 key.
I use NotePad++ because it is a fabulous editor... I like the find utility, the user designated highlighting and the user designated code folding... makes things a lot easier.
On the face of it... Python on a super-P2 system seems pretty stupid. But it looks like serious work to get uPython working... mostly I was wondering how much more it would take to go straight to Python.
I read somewhere that it takes about 2MB of RAM to get Python going... that would be 4 P2s … so maybe an OctoProp2 would be the entry point.
? but uPython already exists, and is working on other MCUs, for precisely the reason that full python is too large for MCUs.
Yes, it was serious work, but that work has been done, plus there is a alpha version of uPython running on P2 already, using that existing other MCU work.
"Indeed - getting full-blown Python running on P2 seems a waste of time. If you need that kind of power, use a Pi. "
You could be right. Your insistence upon logic is to be commended:)
Forget reason for the moment... What if major players want to use the P2? What if they want an integrated environment, which is easy to build and easy to maintain? What if calling the P2 over some kind of fancy wire just isn't going to cut it for them?
Forgetting reason, you can also run Linux on a 8 bit AVR.
Logic is the reason no one does that commercially.
uPython is already running on the P2. See the first post in https://forums.parallax.com/discussion/169862/micropython-for-p2/p1.
Ozpropdev has done some cool demos with it.
MicroPython is actually pretty compatible with Python 2.7. It's set up to be modular so you can remove features, but if you enable everything the language is very similar to regular Python. Of course it doesn't have as rich an ecosystem, but I think you could change that by porting code over.
Remember... I'm not actually arguing for full blown Python, because I don't know how much more effort would be required than for uPython.
Right now, if you want to use something like Intel's Realsense technology and a P2 together, the simplest thing to do is use Python... you then broadcast requests and data between Python and the P2 in some way.
What is the difference? ... it is like comparing a neural-activated prosthetic hand to a real hand.
In a robot, the P2 is analogous to a mid-brain. It uses its own logic, but doesn't necessarily have executive control...putting the midbrain as close as possible to the executive is the best way to use it. That way the communication(feedback) loops are as short and simple as possible.
I think this would make a great topic for a DD grant application.
I'm thinking that someone reading this could... you know, call a friend:)
This item in the news recently, was very much P2 territory (hard real time control), and a good example of that Host-Node link. AP1050 SPI to 3 phase PWM motor driver.
https://www.akm.com/akm/en/aboutus/news/20181018AP1050_001/
Maybe there is enough analog stuff inside AP1050 that it gets used with a P2 ? These decisions come down to price and PCB area.
Thanks for posting this. I'm not proficient but here is a couple of extracts of what I wrote for NotePad++ to do some automatic file conversions for work
I am in awe at guys(and gals) that can just inhale this stuff and spit it back as beautiful as a sculpture.
Not only could I not do this... I didn't even know it was possible:0
Thanks