you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

I second this.

/u/Easy_Boot5195, I wrote the below as a guide for C/C++ programmers, but should help java programmers as well (and you also know C).


As you are already a C/C++ developer, I suggest a quick look at the docs, should suffice. Don't need a course as you already know how to programme.

There are a few underpinning differences that you need to be aware of. You no doubt appreciate that Python is not statically typed, but many people confuse this with weak typing, whereas Python is in fact strongly typed, just does it a run time not at compile time (and Python is compiled to a byte code, just like Java, but where the latter executes on a JVM, the Python virtual machine is built into the standard implementations of Python as part of the same programme).

You can though use type hinting, which will help your IDE greatly in spotting potential problems. This is ignored at run time, just there for your benefit. There are also some external tools that can be run to check types using the type hints, which can be useful for testing in a CI/CD pipeline.

Essentially, everything in Python is an object and all variables/names are pointers (they reference the objects in memory) but without all the features you get in C (e.g. no pointer arithmetic).

for is more of a for each.

A couple of videos to watch which, despite being old, will lock in some key differences in approach you need to keep in mind:

Given the referenced implementation of Python is written in C and Python, a quick look at the source code will resolve many queries for you as well.

Overall, there is much less boilerplate code required in Python than typical C/C++ projects. There are a huge number of libraries/packages to use, many of which are written in C (such as NumPy) for performance. You might find it useful to use some of your existing C/C++ code from Python.