I'll make this a new topic since it's more programming related, and since I'm by no means an expert, perhaps @byron or @TFMcCarthy (who are more experienced Python programmers) could weigh in. Plus, I'm not a professional programmer (in any language). Most of my knowledge of Python/Micropython comes from working through all of the McWhorter videos on the RPI 4/5, RPI Pico, and now his "AI on the Edge" class with the RPi5.
With respect, I have to disagree with you on your view of Python/Micropython. Obviously, code running in C/C++ is much faster (once compiled). It may be more ‘portable’ from system/device to system/device (I’m not an expert, so I don’t know for sure). But, for quick little scripts to test out something with a microcontroller or to make changes/corrections in a Python program you are developing, Python is much easier and quicker (IMO).
Also, how many years of experience do you have in coding in C/C++ versus what you have in Python. I know you’re a big fan of the ESP32 ecosystem and have done a lot of work with both the ESP8266 and the ESP32. So, naturally you’re going to be much faster coding with C/C++.What was it like when you first started coding? Was it all this same confusion/fog (I don’t know what to call it), when you first started with C/C++, that is your view of Python now? I think the continued experience in coding in one particular language builds up those ingrained memories of how things work. The old saying goes something like ‘practice, practice, practice… makes perfect.’ The more you code in Python the easier it will become.
And it’s true, Micropython is not Python (close, but not the same). Micropython was developed with microcontrollers in mind. I also agree with you on the Anaconda vs. no Anaconda debate. When I went thru the Python classes at MIT and UMich, it was the same thing, one professor wanted you to use Anaconda, the other didn’t care. Anaconda adds a lot of 'extras' (Jupiter notebooks, their version of an IDE, etc.), that just add 'fluff'. I personally don't use Anaconda. As for updates... that's the nature of the beast! I think a prime example is the Jetson Nano and the Jetpack software. When I first played with the Jetson, I'd spend hours (days) getting something to work, a Jetpack update would happen that would 'break' everything I had worked on for all that time. It quickly soured me on the Jetson.
I started with Python, so for me Python/Micropython is easier than C/C++. I’m also a fan of the RPi ecosystem (which is more Python/Micropython oriented - although you can also use C/C++, if you like) which clouds my view. So, I guess my point is… give Python a chance. Regards, Lee
I had to look to find what triggered your post and I presume you were referring to a post where a python newbie had played with python, did not know how functions and global variables worked, clearly had not taken much time to learn the basics, and remarked he felt uncomfortable with Micropython. Which prompted some @inq observations.
The only points worth mentioning, as you pointed out, is that Micropython is not Python so its not expected that there is code portability between the two, Python releases do not break existing code with the one exception some 18 years ago when python was overhauled and went from V2 to V3 which was long in the gestation and no one was caught unaware.
Python does not let you step-by-step debug as is, though of course there are debuggers available. Python and Micropython have a Read Evaluate Print Loop (REPL) where python statements can be entered for immediate execution. Creating code is normally done within a code editor that may or may not be within an IDE, but the REPL in a separate REPL window proves very handy whilst creating a program to skip out from the editor to remind yourself how a particular statement works.
Like you I was not a professional programmer apart from a very brief spell for just about 2 years when I undertook a couple of contracts doing VB6 and SQLserver projects (1995'ish I think). I moved on to contracting as a Project Manager as I found it was better paid. 😎 (Specialising in SAP projects for the last 10 years of my working life.) My Python and C coding was only as a self taught hobby programmer when I retired and got a raspberry pi and an arduino uno. Proper c++ rather than arduino c/c++ type of coding was just undertaken as a self taught exercise, but never properly taken up as I found I could do all I require in Python and latterly in micropython.
Most of my playing these days is on various microcontrollers and when Micropython came out, or rather couple of years after it came out, as I had rpi Python under my belt I gave it a go, rather with the thought I would probably have to continue to use Arduino c/c++ programming for a lot electronic peripherals and for speed. It has not proved to be the case, as yet anyway.
I would not go as far as suggesting that @inq tries using micropthon for his esp32 projects as he's clearly quite happy with his c++ endeavours and I think he's only doing some python because he finds that most AI examples use Python so wants to get up to speed on that front.
For me, and I expect for you, I enjoy the vast amount of that is contained within the standard Python libraries (and thus can be found on all Python distributions). Compared to c/c++ I like the python indents as code blocks instead of braces, I like the readability of Python. I mention this because one of the first things said in woe about Python from those coming from c is the bewilderment and how stupid it is to use spaces as coding blocks. 😀
At the end of the day, and usually it is towards the end of the day, that I like to dabble with mucking about with this stuff. Right now I've just been having a go with getting an additional POE board soldered onto a wiznet rp2350 board that has an ethernet connection. I had to build my own Micropython firmware for this board as it not on their standard supported boards list. And it all appears to be working. It will work well for the sensors and weather-station in my workshop as I will only need one POE ethernet hub and ethernet cable in place of several wall warts wth their spindly and overly long cables. It will be easy to modify my existing code to accommodate the change to ethernet from wifi as I will actually be able to read my undocumented code as it was all in Micropython. Yes, I like Micropython, but I'm not fussed if others take a different tack.
But well said in your post, and lets hope the Python classes don't make poor @inq feel too queasy 😀
Sorry, I should have referenced @inq’s post in my comments.
Like you, I’ve never had a problem with backward compatibility with the Python (or Micropython) versions. Programs that I wrote years ago still work today (on the latest versions of Python - granted they’re not 1000’s of lines long or very sophisticated, but they work). I normally work in the Thonny IDE, and use the REPL feature of Python/Micropython - very handy! VSCode also works extremely well and has better debugging capabilities.
My comments to @inq about Python/Micropython were only because he seemed to write it off after only a few (formal) lessons in Python. In my mind, use whatever language you are most comfortable with and that can get the job done. I happen to prefer Python/Micropython. Thanks for your comments. ...lg
I'll make this a new topic since it's more programming related, and since I'm by no means an expert, perhaps @byron or @TFMcCarthy (who are more experienced Python programmers) could weigh in.
Hi Lee!
I really should thank you for provoking me to get back here. I've had a very bad 2026 with major setbacks with my home that have knocked my trolley off the track and taken all the wind out of my sails. I've been moping around now for weeks trying to get the energy to get back to my SmartCar project without success. I'm hoping your post will get me running again.
So, I should thank you. But that would mean I have to be nice to you. Rats!
Well, if I have to ... I guess ...
Thank you, Lee.
The never-ending general question is "What is the best programming language?" or "What programming language should I learn?" There's no definitive answer to these questions but that doesn't stop people from asking or arguing about them.
Before I present my answer, I want to pose a few questions that should help clarify the choice you make:
- Why am I learning to program at all?
- Is it for a hobby or a professional purpose?
- What's my programming goal?
- How much time and effort do I want to devote to the effort?
In the DBWS forum, the reason to learn to program is to control an electronic device with a microcontroller/processor. Note this is not the same as learning a general-purpose language for a general-purpose computer. Here we are constrained by the languages and devices available. We may further constrain ourselves to a subset of the language that is supported on the device.
IMHO, most DBWS members are hobbyists as opposed to programming for a living. Members aren't required to learn to program the Arduino, ESP32, or RPi for work purposes. So, it's mainly casual programming. After a time they become more serious about the quality of their programs, but it then becomes a case of unlearning bad habits. What's important about this are your expectations. Casual programming is mostly "one-off" projects that are not meant to last very long or be reused in other projects. You just want to get the program to run and be mostly correct. As time goes on you'll probably spend more time crafting the program and become move professional at programming.
Most DBWS projects have a specific goal. Learning how to control a device or set of devices; performing a specific action or task, etc. Anything unrelated to the goal distract from achieving the goal. Engineers are famous for getting distracted from the goal by some "shiny" object or unnecessary complex process.
Time is precious and your energy is limited. Accept the fact that you'll never know everything about anything. Still, something worth doing is worth doing well. Guage how much time and effort you are willing to devote to programming. Caveat: IMHO, today's electronics require a higher degree of programming skill than previously. You can get something running with a trivial program but will be forgotten by the next project. Don't expect to accumulate a skill set this way.
Enough babble; time to answer the question.
Python is an interpreted language and, like many interpreted languages, is fairly easy to learn. MicroPython is a variant for use with microprocessors, and thus a reasonable choice for the DBWS projects. Python has strong library support and can be used for a wide variety of projects. A major drawback with interpreted languages is the overhead of the interpreter and a lack of direct hardware access. Since one of the major constraints of today's microprocessors is memory, this overhead to be too expensive for me. If I have to use a library to access the hardware that just makes it worst. Other concerns (speed, efficiency, etc.) are more project specific.
C++ (n.b. @lee-g, see "C++ not C/C++"; You're welcome. We're even again.) is a compiled general-purpose language. It is widely supported on most platforms but has a reputation for having a steep learning curve. It supports both high- and low-level programming and is well known for being very efficient. C++ is arguably the de facto "native" language for microprocessors and therefore suitable for DBWS projects.
This sounds like a cop-out but isn't; Which language you learn and use is the one that you're most comfortable and productive with. You don't need to defend that choice. Choosing one language doesn't preclude ever using another. As long as you can achieve your goals then the language is sufficient. When the language can no longer achive the goals is the time to switch.
If communicating your programming ideas to others is a major goal, the programming language has a enhanced impact. I'm not a Python programmer so I have trouble reading Python programs, but I can muddle through or ask for help. But the truth is that unless I have serious desire to know how something was done, I tend not to read Python code. For my C++ programs I'm acutely aware that many DBWS members aren't fluent with C++ so I spend extra effort to explain my algorithms.
Hopefully this helps but I need to get off the stage here.
The one who has the most fun, wins!
First, I’m sorry to hear about the problems upending your world. I know getting back ‘in the groove’ after something catastrophic happens can be a chore. So, if this post helps you in that regard, I’m glad to have helped give you that little nudge you needed.
Second, Be nice to me??? Why should you be any different than anyone else? I’m just a grumpy, old man, with nothing better to do than cause trouble! Just ask my wife, kids, grandkids…
Third, Point taken on C vs C++. It’s my mistaken impression that they were similar (actually, I’d always thought C++ was sort of a derivation of C, kinda like C# is another derivation of C). But, obviously not and I’m wrong about that too! Nothing new here… I’m wrong about a lot of things these days.
In the end, I read your conclusion to mean essentially the same as I came to. As a hobbyist, work in the language you’re most comfortable with and that can get the job ‘at hand’ done. That’s not to say you can’t (or shouldn’t) try other languages. I’ve dabbled in Arduino-style C++ over the years, but I prefer Python/Micropython.
BTW, please continue working on your smart car project, I’m anxious to hear your progress and conclusions. As for my excursion into robotics and my self-balancer (Sam), it’s been a learning experience!! Porting the Arduino code over to Micropython was/is a lot harder (for me) than I thought it would be. But, Sam is standing and moving around (sorta) without falling over every 10usec, so I guess that’s progress. And... I have my eye on another 'shiny, new, thing"... a quadruped!
Thank you for your comments, please take care. Regards, Lee
I'll make this a new topic since it's more programming related, and since I'm by no means an expert, perhaps @byron or @TFMcCarthy (who are more experienced Python programmers) could weigh in. Plus, I'm not a professional programmer (in any language). Most of my knowledge of Python/Micropython comes from working through all of the McWhorter videos on the RPI 4/5, RPI Pico, and now his "AI on the Edge" class with the RPi5.
....
first of all, where can I find the courses you mentioned ? I usually dive deep with AI. 😀
In my experience, Arduino and ESP series are microcontrollers, while RPI 4/5 are microprocessors. On Arduino you upload a sketch , but on RPI you have a full-fledged computer, with OS, which is much more powerful.
So for the sake of flash limit constrains, yeah it's more reliable to use C or Arduino, rather than python. An alternative might be micropython but for this C is the profesional way, just because you allocate better the memory usage of ESP microcontrollers, and also address the flash limit size of the sketch.
For RPI it's easier and fast to use python. I haven't tried to use C, but I think you can do it. The trade-off it's that C requires a steeper learning curve than python, so it's convenient to just use python or javascript on RPI.
Well for me, I would use more C if needded. I don't learn something just because is mandatory, but because I will use it. So general speaking it's not impossible to learn C, although I didn't go through it just yet.
For simple projects with ESP I am planning to use Arduino, just because it may be enough.
With C you can use pointers, which drastically improve the sketch performance. Theere is also some theory about RTOS and some other complicated terms I don't know much about it yet.
-----
most of the help is on @tfmccarthy answer, but I commented just to socialise and improve my english. haha.
My curent working (personal projects / hobbies) it's full speed on the documentation. haha. I learned a lot on RPI, and I need to document my stand point, before I can move ahead with ansible. I'm comfortable with docker containers (wich I also learned wit help of AI), and the ansible it's the missing part to improve the quality of my infrastructure settings.
The two university level courses I took from MIT and UMich are offered on edX.org and coursea.org. Also, MIT has a webpage that lists their Open Courseware (ocw.mit.edu) courses. These are videos of the actual (in-class) lectures the professor gives. It has the whole semester of lectures for the particular course listed. The course from UMich was intro to Python with Dr. Chuck Severance. It was a good introduction to Python. The MIT courses were MITx 6.0001/6.0002 Computational Computing with Dr. Ana Lee and others. It was also basically an Intro to Python course (but much more involved). The other courses are from Paul McWhorter, a YouTube creator that offers tutorials on the Arduino, Raspberry Pi 4/5, RPi Pico, and now “AI on the Edge” with the RPI5. Regards
I have the highest respect for everyone of you and have in the past learned from your all's trials and successes. I tend not to feel that my opinion carries that much weight and certainly not to the point that I trigger another "best" anything debate. I don't like them, and try not to engage in them. They're all about opinion. That I spawned this topic, I sorely regret. I tried (and failed) to simply vent my frustration with Python. I probably should have made this part more prominent. "I think you've just driven last nail in the coffin for me using Python." I try my best to indicate my opinions versus facts.
I think much of my angst came from my last couple of weeks at university. I'm taking classes in Physics, Computer Science and Engineering where I am the oldest student on campus. At the same time, I'm also interviewing, and dealing with HR to become a professor. I just finished mid-term exams while preparing presentations and giving guest lectures to teach an Engineering class this spring. I'm just now returning to the forum and finding I have a backlog. 😆
They also asked me to teach a C++ class. Although, I gave it thought, and re-thought out of respect for the department head, I finally, said there was no way, I could in good conscious teach that class. I could not strait face recommend to a young mind to go into C++ as a profession or even as a language to support quick-and-dirty engineering analyses. Although senior developers in C++ are still in high-demand, getting from entry level to a senior level requires experience and that can no longer be had due to AI. However, that same logic applies to any language including Python.
However, I would completely agree with the logic that for the hobbyist, the engineer needing a Q&D analysis or even academic research, it would be very hard to beat Python. I can easily recognize that. I would also stipulate (my opinion) that for any production code, it is totally unsuited. In that case C++'s product speed, compactness, stability and maintaining at least a semblance of Intellectual Property are paramount considerations.
Inq
I think a prime example is the Jetson Nano and the Jetpack software. When I first played with the Jetson, I'd spend hours (days) getting something to work, a Jetpack update would happen that would 'break' everything I had worked on for all that time. It quickly soured me on the Jetson.
I would be very interested in your insights and trials on the Jetson. I've considered it several times and was only swayed by the cost. Have you documented your work here on the forum? If so, do you have links? If not, would you consider sharing?
I started with Python, so for me Python/Micropython is easier than C/C++. I’m also a fan of the RPi ecosystem (which is more Python/Micropython oriented - although you can also use C/C++, if you like) which clouds my view. So, I guess my point is… give Python a chance.
I wrote a chronology of my language knowledge, but deleted it. Let's just go with, I can hold my own in ten languages. My biggest problem these days is remembering something I need and having to ask Google which language it is in and finding the equivalent in the language, I currently writing. Adding Python to that mix is painful. 🤣
I will inherently be using (and learning) Python because it seems to be the only language they understand. I guess this is how a multi-lingual Frenchman feels when they run into an American. 😋
Inq
Specialising in SAP projects for the last 10 years of my working life.
SAP AG??? - Interesting, my last 10 years before retiring was with SAP. I worked in their mobile management division in Atlanta, USA. SAP Afaria.
Compared to c/c++ I like the python indents as code blocks instead of braces, I like the readability of Python. I mention this because one of the first things said in woe about Python from those coming from c is the bewilderment and how stupid it is to use spaces as coding blocks.
I have to admit, this bothers me. The clarity of my {} is concrete. That I might fat-finger or not... a tab or space and completely screw up the logic. That Code-completion puts these in for me negates arguments of the time for extra key-strokes. But then... I also argue against putting the opening brace at the end of a statement. I religiously put mine in the same character column. I even do this in my JavaScript.
But well said in your post, and lets hope the Python classes don't make poor @inq feel too queasy
![]()
I'll try to puke before going into the classrooms. 😆
Like you, I’ve never had a problem with backward compatibility with the Python (or Micropython) versions.
Maybe, it was the teacher. On at least five occasions where she publishes code to us students to teach Python, Anaconda, and something she called AI... which was closer to BS. Anyway, when we ran it, it would keep failing. She'd load it up, during class and sure enough, it wouldn't work. She'd waste lots of class time and finally have to defer it to the next class. That it happened on more than one occasion, show a distinct lack of respect for her students. I found it very unprofessional for a professor not to have reviewed their own lectures. She attributed it to Python upgrades since the last time she taught it. I see from your notes, it might have colored my opinion on Python. Now, I might just chalk it up to another black mark on the professor.
Inq
I really should thank you for provoking me to get back here. I've had a very bad 2026...
I sure hope you come back. I too had many personal trials and left the forum two years ago. I've only been back the last three months. Things have changed a great deal, but I find this place rewarding (except when I'm on the receiving end). 😉
Seriously though, anyone working on projects at the level of robotics is a kindred spirit and a peer, which where I live in rural America now are totally absent. To be able to get insights into other's projects and to offer suggestions and/or get constructive criticism is priceless to me. Even at the university, I have been unable to find any classes shining light on this field. After, explaining my goals and getting shuffled along to some other dean or department head, I'm finding they're more likely to prod me to teach what I already know. I can only assume, the high-6-figure salaries the AI industry is offering is sucking academia dry of talented professors.
Inq
Thanks for your comments.
With regard to the Jetson Nano, sorry, but I did not document any of my ‘trials and tribulations’ with that board. I bought one and tried to follow McWhorter’s video series on the device. It was several years after he published the original videos and of course most of the JetPack software had changed by the time I tried to get the board going. I would get many ‘file not found’ errors because the dependencies (I guess you call them that) had changed, been moved, or not used anymore. Scouring the Nvidia forums was of little help to me, mainly because I didn’t know enough about the board, the Jetpack software, and how everything fit and worked together to be able to ask the right questions. Once I finally got the board to boot and was able to do anything, I worked on a little project (doing a simple object recognition in OpenCV, as I remember). I got the program to work and set it aside for a few days (maybe a week or so - I was also attending college at the time). When I come back to it, I was getting the same ‘file not found’ (dependency errors) as when I first started with the board. After spending many hours (days) trying to chase down all the changes, I gave up, put it back in the box, and haven’t touched it since.
Since I’ve become more interested in AI, I’ve been very tempted to purchase the Jetson Orin Nano, mainly because McWhorter (and most everyone else) speaks so highly of the board and what it can do, how fast it is, and how you’re able to do all the (basic) AI stuff with it. And, McWhorter has published several tutorial lessons on the new Orin Nano, and (I think) is developing another course using it as a platform to get more heavily into AI. But, cost is a huge factor for me. I doubt I’ll ever get one.
I bought the Raspberry Pi AI HAT+2 to go with the RPi5 I have, and will use that to ‘play around’ with some of the AI vision models that are out there. Besides, I’ve been bitten (hard) by the robotics bug and have been putting my time (and money) into that recently. Being more of a ‘hardware’ guy, playing with the robot is more down my alley than sitting in front of a terminal and staring at a screen all day. (No offense intended to all you programmers out there!)
As for Python vs C or C++, obviously C++ is the choice for a production-type project, or even with hobbyists well-versed in the language. But, I’m not an experienced C++ programmer, so Python/Micropython is my language of choice. I know I opened a ‘can of worms’ with my original post on the subject. I’ll leave it with my conclusion that, as a hobbyist (or anyone else), use the language you are most comfortable with and that can get the job done.
I agree with your comments about the Python instructor you have/had. She should have reviewed her lessons/code before class to make sure everything still worked (IMHO). Fortunately, I had three very good professors for the formal (university) classes I took (online) in Computer Science/Programming with Python. They knew their ‘stuff”!!
Good luck with your studies.
Best Regards, Lee
SAP AG??? - Interesting, my last 10 years before retiring was with SAP. I worked in their mobile management division in Atlanta, USA. SAP Afaria.
Yes SAP AG, but I was working as a freelance SAP consultant not working as a SAP AG employee. I went down this path when I was managing a project to replace various disparate business systems the client had ended up with due to various mergers and acquisitions with a single 'Enterprise' package and SAP was the one selected.
During my time working on SAP projects only one of my contracts was actually directly with the SAP AG company itself and the rest of the contracts where, in the main, being contracted by the end user client but with a few contracts for other SAP implementors usually one of the big Accounting firms consultancy wing.
Oh well, a bit of down memory lane musing. 😍
Back to the subject matter, though I expect you may now be well aware, but for the completeness of my previous remarks on new Python releases not breaking old code, I should clarify a Python implementation consists of the Python language, with a bunch (large bunch) of standard modules. One expects that these standard library modules do not break existing Python code and are maintain by the Python.org developers.
But there are a lot of Python modules that are not part of the standard library and are maintained by different folk. An example is numpy. A very useful and well used Python library but its a different bunch of developers to update it. And these packages are then uses as dependancies for other packages such as OpenCV. The version of these libraries used together in a development can be critical
When developing in Python its usual to create a project environment ( a virtual project or VENV) within which external modules relevant to the tasks required can be installed. This is facilitated by using a Package Manager. A good relatively recent such manager is uv. https://github.com/astral-sh/uv
The package manager will keep the information as to which version of which library was used enabling others to reproduce the same environment when utilising the development.
As far as my understanding of Anaconda goes, (I do not use Anaconda) it is a package manager that includes Python (of course) and a host of other modules and packages curated to work together, with data science being its rational.
I bought the Raspberry Pi AI HAT+2 to go with the RPi5 I have, and will use that to ‘play around’ with some of the AI vision models that are out there
You probably know, but just to remark that rpi produce a book called AI Projects with Raspberry Pi.
https://magazine.raspberrypi.com/books/ai-projects-raspberry-pi-essentials
I got the e_copy a few months ago and though I've only given it a cursory look I think it will get you started quite quickly with your AI HAT. Whilst Paul McWhorter does present some good stuff, I find some frustration with his style and, for me anyway, the book looks more my cup o tea.
I got the rpi AI camera when it came out and it worked well enough when using the provided examples, but then I realised to use it as I intended, recognising objects of my choice, I would have to create pictures of the object from all different angles etc, with over 100 pictures being required. These would then have to be fed into and AI training engine of some sort (I will have to read that AI book properly to use the correct terms) which would need to be run on a powerful computer, and then some other hoops to go through before the goal was achieved. Oh well it was put aside for a rainy month or two when I have nowt better to do. 😎
T
That I spawned this topic, I sorely regret.
Nah, forget the regrets. We're discussing the topic. It's a unresolved topic. It's the nature of discussions that unresoleved topics come up over and over again. What's old news to older members is a hot topic for newer members. What you can take some credit for (as well as @lee-g, but don't tell him 'cuz he has a swell head already.) is that it provokes more members to contribute to the discussion. That's something we need more of around here, me thinks.
I finally, said there was no way, I could in good conscious teach that class. I could not strait face recommend to a young mind to go into C++ as a profession or even as a language to support quick-and-dirty engineering analyses.
Ah-hah! You're just the kind of reader I want to address. It's one of the things I hope I can touch on in my SmartCar project, i.e., practical use of C++. My premise is that the "traditional" methods of teaching C++ are so god-awful and scare people away. In this regard I would recommend the book Principles and Practice Using C++ by Stroustrup as a excellent example of how to present C++.
This also raises the question of the goal of the university course of study. Is it to produce Python programmers or train them how to program regardless of language? Nobody wants to earn a university degree in a field with no jobs, temporary jobs, or low skill jobs. I'm not a Python programer so my POV is very subjective. I'm at a loss as to how to distinguish between junior and senior level Python programmers. That's not the case with C++ programmers. As an introduction to the programming profession, Python is fine. As a core language for a university degree in Computer Science or Engineering, it's insufficient. YMMV
The use of AI assitance programs to advance and explore is another hot topic here. The topic is so new we need tons more emperical results to evaluate it.
I sure hope you come back.
I think I'm recovering. But I confess that the SmartCar project is a real tar-pit.
The one who has the most fun, wins!
