r/PythonLearning • u/saikat_hossen • 10d ago
Python Programming
Have any Python learning tips?
2
Upvotes
2
u/vlcod 9d ago
Get a good book, read it and work through it.
There are no shortcuts. Don't expect that you can just watch a few videos, and it'll come to you. You need a proper explanation, and practice.
Have patience, perseverance, and stick with it. Everyone runs into frustration. Don't be discouraged by it – it's normal. Learning needs friction.
1
2
u/PranDopp 10d ago
Python is an incredibly flexible yet powerful language. One of the weirdest quirks about python is how everything is an object aka a class. There are no primitive data types like int or char in C++.
My only tip is to really understand what’s going on in the background when you write a line like this “ X = []”. This line of code creates a list object and assigns the variable X as a reference to the object. So if you then type “Y = X”, this second line of code just creates a new variable Y that is a reference to the same mutable (editable) list that you previously created. This second line does not copy the object or create a new one. It creates a second reference variable to the same underlying object, so basically an alias variable. This will feel weird if you’re used to other languages like C++ where function calls and assignment are automatically by copy unless explicitly changed to a reference.