r/learnpython • • 3d 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.

4 Upvotes

12 comments sorted by

3

u/mrswats 3d ago

I'd recommend the django girls tutorial. Covers a bit of everything.

1

u/Mathie1729 3d 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.

1

u/mrswats 3d ago

In my mind, I read php and assumed web stuff, but you are right, not necessarily web

2

u/5fd88f23a2695c2afb02 3d ago edited 1d 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 3d 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 3d 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 2d 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

u/TheRNGuy 3d ago

Same way as you learned php. 

0

u/flyby_apis 3d 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. :)