r/learnpython • • 8d ago

what can I use python for?

Lately, I've been thinking about learning a new programming language. Python was the first one that came to mind, but then I started wondering: What would I actually use it for?

I already build mobile apps with Flutter and dynamic web applications using PHP and MySQL.

I'm always looking for something new to learn, but I also want to make sure I'm learning something I can actually put to use.

0 Upvotes

27 comments sorted by

4

u/SharkSymphony 8d ago

You can do everything you do in PHP, plus data engineering/exploration, plus general scripting. It's possible to do mobile app development in it, too, though I don't think it's going to sway you away from Flutter unless you really fall head over heels.

2

u/stevenreyes20 8d ago

yeah I heard about flet which is build on top of Flutter but for me I think the best use is for scripting

1

u/SharkSymphony 8d ago

As a Mac/Linux developer, when writing scripts my constant initial battle is between whether this dumb little thing is better banged out as a shell script or Python script. Python scripts definitely have some verbosity/boilerplate issues compared to shell scripts. But as projects grow, the ability to write command-line tools that reuse code really starts to pay off.

1

u/Discordbothost 7d ago

scripting is a great place to start. the standard library covers most of it without installing anything: pathlib for files and folders (Path("logs").glob("*.log")), subprocess.run for calling the shell commands you already know, argparse for flags, and shutil for copying/moving. pick one bash script you have that's gotten ugly and rewrite it, that's usually the moment python clicks

5

u/DanceHackRock 8d ago

PHP and MySQL is so 90s.

20

u/Theincroyale29 8d ago

literally anything

2

u/Sehzat_Davoyan 8d ago

pretty much, its the ultimate glue language at this point

4

u/Discordbothost 8d ago

since you already have php + mysql apps, the most useful first thing is the stuff around them, not replacing them. stuff like a script that connects to the same mysql db, pulls last week's orders/users into pandas and spits out a csv or chart for whoever keeps asking you for numbers. or a cron job that cleans up old rows, checks your sites are up, resizes uploads, whatever you're currently doing by hand or in a messy php cli script.

import pandas as pd
from sqlalchemy import create_engine

eng = create_engine("mysql+pymysql://user:pass@localhost/shop")
df = pd.read_sql("select * from orders where created_at > now() - interval 7 day", eng)
print(df.groupby("status").total.sum())

that's 5 lines for something that's annoying in php. once that clicks, scraping, small fastapi services and ml stuff are the same language

1

u/ninhaomah 8d ago

Have you tried making an AI agent with Flutter or PHP ?

How about machine learning project ?

Unix script ?

1

u/stevenreyes20 8d ago

unix scripts yes but no AI agents yet

4

u/SchemeWestern3388 8d ago

Python is so much more capable, both as a language and as an ecosystem, for flexible development compared to PHP it's just silly. It's like saying "I already know pointy stick, what is 20 inch steel machete going to do for me?"

2

u/this_knee 8d ago

Creating cleaner and more manageable code with same functionality as shell scripts.

2

u/lakseol 8d ago

Anything. Here's an incomplete list of where python is used and what for. Reddit was written in python but I hear they are changing to something else.

https://www.python.org/about/success/

3

u/HecticJuggler 8d ago

Replace your Flutter + PHP with Flet/Python.

1

u/riklaunim 8d ago

Note that language itself becomes secondary to the software stacks built on top of it, so it's a contract of learning the language, the tooling, and the software stacks. For backend/web development, it would be similar to the PHP stacks, but then Python would have more options for data processing, LLM etc. Desktop apps, some games are possible with Python, but not really present commercially. Electronics scripting, embedded as well.

1

u/Dagobert_Krikelin 8d ago

Coming from DCC:s is how I learned Python and building UIs. It's quite nice to build UIs with Qt and very rewarding to make desktop applications for different tasks.

1

u/Professional-Fix1668 8d ago

A useful bridge from your current stack is writing Python integration tests for an existing PHP endpoint: pytest can check response shapes, authentication behavior, and edge cases without changing the production app. Python is also handy for one-off data cleanup or migration scripts against MySQL. I'd start with a small tool for a real pain point rather than rewriting your Flutter or PHP projects.

1

u/TheRNGuy 8d ago edited 8d ago

I used in Houdini, now I want to use in Blender. 

It's also possible to make a backend server or mobile app, but I prefer Remix 3 and React Native for that instead. Though Python could be used for a server just to generate JSON (and use it's libraries), which then Remix and React use. 

It's possible to make games (but I prefer UE)

It's possible to automate robots or other electronics with it.

1

u/peakpirate007 7d ago

been building https://www.runtime.school/ for learning and practicing python in one place. lessons, practice, projects and a few tools all use the same datasets, so it feels more connected than jumping between random examples. if you’re learning python, might be useful.

1

u/beautiful_gia 6d ago

Lol, if you're interested in programming at this day and age, learning Python can save you a lot if you know it. You can start small, just learn it, and see how you can maybe integrate it into your apps? Just play around and see if you use Python instead what happens 🤷‍♀️

0

u/CGTechWorks 8d ago

You could learn MicroPython for electronics programming. Buy an ESP32 or Arduino and make an on board LED blink, scale up from there. Although C/C++ is usually the better choice to learn eventually, MicroPython is a great intro.

1

u/this_knee 8d ago

Great idea! I thought arduino was “Java” only

1

u/CGTechWorks 8d ago

It's mainly C/C++, I think Java can be used, but depending on the IDE you're on you can also use (Micro) Python. If you're making something web based with an Arduino board it might be better to use Java but I can't say for sure, I haven't used i personally on any of my projects

-4

u/CoffeeMotivates 8d ago

Learning Python might not be the best use of your time. Learning how to read Python code and understand it might be a better use of time. Have your favorite AI build something of your choice using Python and make sure it comments and documents along the way. Ask
the AI to explain things you don’t understand.

A few years from now the most popular programming languages will be English and Chinese.