Getting back into programming 3 replies

Please wait...

Andron Taps Forum Mod

Faktrl is Best Pony

261,592 XP

10th September 2007

4 Uploads

21,746 Posts

1,754 Threads

#1 7 months ago

So it's been quite a while since I've even looked at a coding language of any kind, but recently I've decided to try my hand at learning a new language mainly for the fun of it and because I love puzzles, so I started learning Python via Codecademy.  My experience with programming started many years ago with a few basic languages that were mostly 99% developed and all you had to do was type in some basic English commands.  Afterward, I did some brief studies in C, followed by C++, and finally JAVA.  I took a formal course in the latter and learned a decent amount.  But Python I'm told is a very different style and takes a bit of getting used to, so I'm wondering if anyone here has any tips, tricks, or horror stories to help me on the way.  I've also been told Python is used a lot by YouTube and even NASA.  Not sure how true the latter is, but like I said it's mainly for a bit of fun.


"I'd shush her zephyr." ~ Zephyr.



Superfluous Curmudgeon VIP Member

AOE2 Addict

11,741 XP

22nd December 2007

0 Uploads

794 Posts

9 Threads

#2 7 months ago

Python is a scripting language. Syntactically, it borrows some things from C (and maybe some other languages that I don't know?) but it is mostly unique in its syntax. It is pretty intuitive though, so you should learn the majority of the syntax in a day or so. Biggest "gotcha" of the language and probably the thing I like the least about it though is the spacing. I'm not 100% certain on this, but I believe the interpreter sees a tab the same as a space. So if you ever change your editor preferences or switch to a new one that say, uses 2 spaces per "tab" instead of just tabs, and then start adding code to a  script that used tab spacing, all hell will break loose when you go to run the code. I'm not sure if there is some standard out there for the spacing  required of published code, but it's something to watch out for.


Second, there's a major split between python versions - python 2, and python 3. Python 2 (up to 2.7.x now I think) has been around for a while and continues to be supported by the majority of packages. I believe it's still much more widely used than Python 3. And the reason is, you can't just jump to Python 3 due to a lot of syntactical differences. That said, some packages, especially some of the GUI packages, only support Python 3 (my use of Python 3 is almost non-existent so I don't know the extent of the feature differences).

Third, a few packages to pick up if you plan on playing around with matrices, algorithms, plotting, etc. are numpy and matplotlib. Maybe scipy too. The former two should be the starting point for any data manipulation and visualization you want to do.

I think you'll find that once you start getting the hang of python, it'll be your Swiss army knife - not necessarily the best tool for the job, but a tool that works for almost any job and one that is easy to pull out and work with on the go. I'm currently using OpenCV's python distro and some neural network package (maybe TensorFlow or something else with GPU parallelization support?) to complete a neural network assignment. If you wanna have some  real fun, I suggest playing around with OpenCV's object recognition capabilities.




Last edited by Superfluous Curmudgeon 7 months ago

Andron Taps Forum Mod

Faktrl is Best Pony

261,592 XP

10th September 2007

4 Uploads

21,746 Posts

1,754 Threads

#3 7 months ago

I came in for a few tips and got a goldmine in return!


"I'd shush her zephyr." ~ Zephyr.



MrFancypants Forum Admin

The Bad

217,010 XP

7th December 2003

0 Uploads

20,003 Posts

6 Threads

#4 7 months ago

Python is great for getting into programming. It will remove a lot of the low-level stuff and syntax-related overhead that can make programming in other languages painful. It encourages good formating by making it part of syntax (standard is to set your tab to 4 spaces in your favorite editor and you won't have any troubles with the indent). As it is scripted you don't need to mess with compilers but can run your code very quickly, that's one reason for the popularity of Jupyter Notebooks as development environment.


Python 2.7 used to be more popular for quite a while, at this point there is no reason not to switch to Python 3. From a user perspective the differences are very small and all big libraries have been ported.


There are also a bunch of drawbacks. As it is not compiled you don't get the benefits of e.g. compilers testing your types, which is important for software development projects to prevent bugs. In terms of performance it is much worse than C or Java, but it will get the job done for many, many applications (the heavy lifting is often done by C++ code under the hood). Paralleization on CPUs is a total mess, but that is not normally a problem for the sort of topics that you work on with Python. So while it is good to get started, it will limit you a bit for more advanced topics.


As python is so popular most of the interesting frameworks out there have Python APIs, which makes it very easy to jump into any topic with just some basic Python skills like web development, robotics or machine learning.


Python is often the language of choice in data science (along with R), so good starting point if you want to get into that topic.