C vs Python
-
Python is featured as the programming language for the Raspberry PI. I’m new to this maker thing and now I am also playing with the Arduino. Last night I was working with an Arduino video and found that you can use a version of C. That was so much easier than Python. Admittedly I program in C# every day and C was my first programming language course. With the version compatibility problems in Python, all that indention thing, C is my choice. Curly braces forever!
Even Python is written in C :-D
-
Python is featured as the programming language for the Raspberry PI. I’m new to this maker thing and now I am also playing with the Arduino. Last night I was working with an Arduino video and found that you can use a version of C. That was so much easier than Python. Admittedly I program in C# every day and C was my first programming language course. With the version compatibility problems in Python, all that indention thing, C is my choice. Curly braces forever!
Python is easier for higher level stuff... since there are so many libraries available for it. I'm definitely a C/C++ guy though. I'm right in the middle of coding some C++ optimizations in a DSP library as we speak. :-D
-
Python is featured as the programming language for the Raspberry PI. I’m new to this maker thing and now I am also playing with the Arduino. Last night I was working with an Arduino video and found that you can use a version of C. That was so much easier than Python. Admittedly I program in C# every day and C was my first programming language course. With the version compatibility problems in Python, all that indention thing, C is my choice. Curly braces forever!
Python is fun. Missing an indent can be a PITA, though[^]. I used to be very fluent, I would probably completely lost today...
-
Python is featured as the programming language for the Raspberry PI. I’m new to this maker thing and now I am also playing with the Arduino. Last night I was working with an Arduino video and found that you can use a version of C. That was so much easier than Python. Admittedly I program in C# every day and C was my first programming language course. With the version compatibility problems in Python, all that indention thing, C is my choice. Curly braces forever!
-
-
Python is featured as the programming language for the Raspberry PI. I’m new to this maker thing and now I am also playing with the Arduino. Last night I was working with an Arduino video and found that you can use a version of C. That was so much easier than Python. Admittedly I program in C# every day and C was my first programming language course. With the version compatibility problems in Python, all that indention thing, C is my choice. Curly braces forever!
Syntactic whitespace is an abomination that should've died when computers capable of compiling something more complex than COBOL went on sale.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt
-
Python is fun. Missing an indent can be a PITA, though[^]. I used to be very fluent, I would probably completely lost today...
Yup, that "whitespace is significant" mantra of Python is pure nonsense. And together with the fact that it is an interpreter, so for real world end user application it is both too slow and insecure, it's more than just a PITA...
-
Python is featured as the programming language for the Raspberry PI. I’m new to this maker thing and now I am also playing with the Arduino. Last night I was working with an Arduino video and found that you can use a version of C. That was so much easier than Python. Admittedly I program in C# every day and C was my first programming language course. With the version compatibility problems in Python, all that indention thing, C is my choice. Curly braces forever!
Umm - it's not "a version of C" - it is C (AVR C - and actually C and C++ mixed together). The compiler is GCC. The "front" you see (with the setup() and loop() functions) - those functions are called by a simple main() - essentially setup() is called first, then loop() is called over and over in a for(;;) construct (or something similar). A preprocessor loads in the main library (Arduino.h or WProgram.h - depending on the version being used) - see http://www.arduino.cc/en/Hacking/BuildProcess[^] for more details. That library is actually a huge monster - with tons of compiler directives and checks for which processor is being compiled for - to get the pin and other assignments correct. It's one reason why (on an objective scale) that Arduino code can be comparatively "slow" - because at the core, a ton of checks and other things are being done for you behind the scenes by the library (not to mention the fact that the compiler flags are set to optimize for size over speed - given that you only have a few kilobytes of program space, and even less of memory - that's a good thing). Could you make your code faster and smaller? Sure - but only at the expense of the code being able to be compiled for only one platform. If you wanted to move the code to another platform, you would be out of luck, until you modified things and recompiled. The system could have probably been made better (ie - independent main libraries per platform, instead of one single giant library) - but given it's origins (the Wiring and Processing hardware/software platform combo) - it's saddled with some baggage that seems impossible to move away from without breaking something or making it more complex for the Arduino's target audience (ie - artists and students, some of whom have never programmed or understand programming). It's also why the IDE is such a (lovable to some) dog - it's based off the Processing IDE, and shares much with it. You can go more bare metal - remember, the Arduino is not the board or the microcontroller - but an entire platform and a community. Nothing says you have to forever only use the Arduino system. If you get better at things, you can certainly ditch the bootloader, and code for the ATMega328 (or other) in straight AVR C (and include inline assembler if you want). In fact, the bootloader and the main library are all done in regular AVR C/C++ - check i
-
Python is featured as the programming language for the Raspberry PI. I’m new to this maker thing and now I am also playing with the Arduino. Last night I was working with an Arduino video and found that you can use a version of C. That was so much easier than Python. Admittedly I program in C# every day and C was my first programming language course. With the version compatibility problems in Python, all that indention thing, C is my choice. Curly braces forever!
Earl Owens wrote:
Curly braces forever!
Hear! Hear!
-
Umm - it's not "a version of C" - it is C (AVR C - and actually C and C++ mixed together). The compiler is GCC. The "front" you see (with the setup() and loop() functions) - those functions are called by a simple main() - essentially setup() is called first, then loop() is called over and over in a for(;;) construct (or something similar). A preprocessor loads in the main library (Arduino.h or WProgram.h - depending on the version being used) - see http://www.arduino.cc/en/Hacking/BuildProcess[^] for more details. That library is actually a huge monster - with tons of compiler directives and checks for which processor is being compiled for - to get the pin and other assignments correct. It's one reason why (on an objective scale) that Arduino code can be comparatively "slow" - because at the core, a ton of checks and other things are being done for you behind the scenes by the library (not to mention the fact that the compiler flags are set to optimize for size over speed - given that you only have a few kilobytes of program space, and even less of memory - that's a good thing). Could you make your code faster and smaller? Sure - but only at the expense of the code being able to be compiled for only one platform. If you wanted to move the code to another platform, you would be out of luck, until you modified things and recompiled. The system could have probably been made better (ie - independent main libraries per platform, instead of one single giant library) - but given it's origins (the Wiring and Processing hardware/software platform combo) - it's saddled with some baggage that seems impossible to move away from without breaking something or making it more complex for the Arduino's target audience (ie - artists and students, some of whom have never programmed or understand programming). It's also why the IDE is such a (lovable to some) dog - it's based off the Processing IDE, and shares much with it. You can go more bare metal - remember, the Arduino is not the board or the microcontroller - but an entire platform and a community. Nothing says you have to forever only use the Arduino system. If you get better at things, you can certainly ditch the bootloader, and code for the ATMega328 (or other) in straight AVR C (and include inline assembler if you want). In fact, the bootloader and the main library are all done in regular AVR C/C++ - check i
Thank you! I've been stagnating in a job where I make web apps for a federal agency, using .NET. At my very ripe old age I feel like a nube in so many areas. The Arduino and Raspberry Pi are hobbies that take the place of vegetating in front of the TV. I have started on Jeremy Blum's Electrical Engineering series using Arduino. I am over half way into Learning Python the Hard Way. It just felt so good to be using curly braces again. BTW I am keeping a copy of your reply for reference and use as a base for further study.