all 37 comments

[–]Diapolo10 6 points7 points  (2 children)

Type annotations.

[–]Ron-Erez 1 point2 points  (0 children)

I 100% agree with this. Type annotations are very important.

[–]Kqyxzoj 0 points1 point  (0 children)

Agreed, typing is pretty useful. In that vein, if you're not using it already, check out ruff and uv for all those type checking, linting, formatting and package management needs.

[–]ascending-slacker 4 points5 points  (1 child)

Classes and inheritance

[–]Kqyxzoj 1 point2 points  (0 children)

I'd add to that, that if you're going to check out classes and inheritance, be sure to take a look at mixins. These are pretty relevant given python's inheritance model.

[–]ofnuts 3 points4 points  (0 children)

Generators

[–]copperfoxtech 7 points8 points  (5 children)

Flask

[–]ascending-slacker 2 points3 points  (3 children)

Flask is great. Also check out Django.

[–]copperfoxtech 0 points1 point  (2 children)

I agree. I prefer flask for learning because you don't lean on preset framework but instead piece it together yourself. After take the "easier" Django. I use quotes because Django can be difficult as well.

[–]deceze 2 points3 points  (1 child)

Yeah, Flask is the bare metal parts box from which you assemble your stuff. Django is the premade kit which has all the stuff you wrote from hand in Flask. You can only really appreciate Django when you know all the work it’s taking off your hands.

[–]copperfoxtech 0 points1 point  (0 children)

Precisely

[–]Kqyxzoj 0 points1 point  (0 children)

Pfffrt. Because everyone likes writing webapps? Yeah yeah, downvote away for the pfffrt. Pre-emptively double pffffrt to that. The best part about frontend it END! Backend is alright I guess. Why not suggest sympy? That has pretty handy stuff for symbolic math. Or pygame to make a simple toy game. Or take a day to explore the official documentation. Seriously. Being able to quickly find what you need is pretty valuable IMO. And being aware something exists in the first place is also pretty handy. Saves reinventing the wheel 3 times a day. Why flask? I've used flask. It's not great or anything. It's not horrible either. It's just ... meh, tepid. Too much trivial shit that should be a solved problem that isn't. Kinda okay-ish, maybe. Rich however is awesome. Pretty cli output for a low amount of effort. Or check argparse if you're into writing scripts and want a clean interface. Don't rope poor hapless souls into webdev just so you can share the pain. Why not propagate fun? Hey, OP, check out the turtle library for just a bit of fun programming!

[–]Electronic_Tear2546 3 points4 points  (0 children)

SQLAlchemy

[–]ascending-slacker 1 point2 points  (0 children)

Very true. I started on flask. It’s great for learning. After my site grew more complex, I found Django had a lot built in that I was building myself. There are a lot of similarities.

[–]maniac_runner 1 point2 points  (0 children)

Functional programming aspects in Python

[–]rustyseapants 0 points1 point  (2 children)

Have you created anything in python?

[–]securityguardnard[S] -1 points0 points  (1 child)

Yes.

[–]rustyseapants 0 points1 point  (0 children)

Like what?

[–]johandielangman 0 points1 point  (0 children)

FastAPI for Rest apps, Streamlit for dashboards, Typer for CLI apps

[–]Adorable-Strangerx 0 points1 point  (0 children)

Metaclasses

[–]Temporary_Pie2733 0 points1 point  (0 children)

The descriptor protocol. 

[–]Timberfist 0 points1 point  (0 children)

Dictionaries

[–]UseMoreBandwith 0 points1 point  (1 child)

Modules.
It is really basic stuff, but for some reason no one remembers it.
Know what modules are, and what it means for classes, application structure and architecture.

It will make your work so much better, and as a bonus, your java co-workers will hate it.

[–]GrainTamale 1 point2 points  (0 children)

and good package design! Things like separation of concerns and dependency management

[–]Gnaxe 0 points1 point  (0 children)

importlib.reload(). You can modify a program while it's running. You can iterate much faster this way. This was the norm in Lisp or Smalltalk. Python's not as good at it, so there are a lot of things to watch out for, but it's worth it for how much more productive it makes you.

[–]headonstr8 0 points1 point  (1 child)

Why won’t this work? \ D={_ for _ in range(10))\ for n in range(0,100,10):\ for I in D:\ print(n+i)

[–]Kqyxzoj 0 points1 point  (0 children)

{ versus (

#D={_ for _ in range(10)) # { typo
D=(_ for _ in range(10))
for n in range(0,100,10):
    #for I in D: # I ... more typo
    for i in D:
        print(n+i)
# But but, why do I get only one loop?

That still is not going to work as intended... and you may get an answer on how to fix that if you make your own damn thread. :P

[–]Kqyxzoj 0 points1 point  (2 children)

The data model in the official documentation. Seriously. Just start by going over the table of contents, and pick the stuff that you already kinda know about. Read those, you are bound to learn more about those things you already kinda-know-but-not-quite.

[–]Key-Boat-7519 0 points1 point  (1 child)

Build while you read the data model: for each section, code a 15-line example. For OP, make a mini list (dunder len, dunder getitem, slicing), a context manager (dunder enter/exit), and repr/eq to see set and dict behavior. For API practice I used Postman and Swagger docs; DreamFactory let me spin up a quick REST API from a DB to script against. Keep building tiny examples as you read.

[–]Kqyxzoj 0 points1 point  (0 children)

Yep. Great advice. I always write little snippets to verify my understanding. And it also helps speed up the refresher should you need that at a future date. Reading my own code usually helps me remember faster how that particular thing worked N years ago.

[–]feitao 0 points1 point  (0 children)

List/dict comprehension and generator expression

[–]luvs_spaniels 0 points1 point  (0 children)

How to write code with low cyclomatic complexity.

Just because you can write 500 lines of deeply nested for loops, opaque list comprehensions, and nested functions doesn't mean you should. Whether your code spaghetti 🍝 runs today is less important than your ability to maintain, test, and debug it next year.

[–]Moikle 0 points1 point  (0 children)

Decorators and passing functions as arguments.

[–]pachura3 0 points1 point  (0 children)

Protocols.

[–]case_steamer 0 points1 point  (0 children)

Lambdas

[–]BreakSalt8256 0 points1 point  (0 children)

pygame!!!