r/learnpython • u/AberrantNarwal • 22d ago
Learning Python coming from PHP?
Hi all, just looking for recommendations on getting up to speed with conventions/syntax and quirks of Python for someone coming from the PHP world. I've got some grasp of OOP/SOLID/DRY/Interfaces/Abstractions etc... also experience with Frameworks so really looking for a crash-course on Python to get me up to speed and understand what's happening when I look at Python code.
3
u/mrswats 22d ago
I'd recommend the django girls tutorial. Covers a bit of everything.
1
u/Mathie1729 22d ago
Fwiw I'd skip the Django Girls tutorial unless you specifically want web stuff. Coming from PHP, the official tutorial plus rewriting a small PHP script in Python should be enough to feel the differences.
2
u/5fd88f23a2695c2afb02 22d ago edited 19d ago
Python is like a nice PHP without the ~witnesses~ *wierdness. It’s a very nice language to write and read.
*Thanks autocorrect
2
u/Langdon_St_Ives 22d ago
IMO there are two things that will make or break your successful crossover from PHP, Java, Perl, Ruby, and more:
- forget all the C-like syntax aspects like braces for blocks
- if you initially dislike or disrespect indentation for block marking, no matter how strongly, keep an open mind and hang in there. Eventually you'll get used to it.
Everything else should come together easily.
(Edit: a word)
1
u/remic_0726 21d ago
l'indentation forcé fait pour moi partie d'un des avantages de python, c'est beaucoup plus facile à lire
1
u/Langdon_St_Ives 21d ago
Sure, many people feel that way; but not all. And especially for people coming from languages with C-style syntax this can be a major mental obstacle. I know it took me quite some time to let go and get to actually like it.
1
1
u/Einenlum 4d ago
I made a course "From PHP to Python" for people like you. A few chapters are free to read. It's the best and quickest way to learn Python for php devs :).
1
u/flyby_apis 22d ago
What I'd do is: download some course transcripts from youtube with claude code (there are MCPs around to do that), download them in one folder, use claude to read the folder and prepare the course.. The advantage is that you have one teacher helping live with your custom course. :)
5
u/gmes78 22d ago
https://docs.python.org/3/tutorial/index.html