Content pfp
Content
@
https://opensea.io/collection/dev-21
0 reply
0 recast
2 reactions

jtgi pfp
jtgi
@jtgi
I’m learning python after 10y of javascript and taking some notes
6 replies
0 recast
28 reactions

jtgi pfp
jtgi
@jtgi
mostly aesthetics, nothing too meaningful since all modern langs more than capable enough
0 reply
0 recast
5 reactions

Señor Doggo pfp
Señor Doggo
@fubuloubu
You don't need to add `*,` in function def to use named args (kwargs), you can just do that directly The `*,` syntax is a hack to actually use named args out of sequence (in the middle vs. at the end of the args), but that's more of an advanced technique You can use `*args` to collect all non-keyword args (or have a sequence), and you can use `**kwargs` to collect all keyword args
2 replies
0 recast
2 reactions

osama pfp
osama
@osama
use uv or poetry, look at generators and decorators, typings good, pydantic is zod
0 reply
0 recast
2 reactions

emo.eth pfp
emo.eth
@emo.eth
if you’re using global or nonlocal keywords, you’re probably doing something wrong. i’ve never used them past intro to cs course and i’ve written a lot of python you don’t need * in fn def for keyword args, it just forces you to specify their name when calling, otherwise you could treat them as positional (and get the order wrong) imo biggest python caveat: it only has function-scoped variables. that can bite you eg in closures in for loops
0 reply
0 recast
1 reaction

links 🏴 pfp
links 🏴
@links
Because the spacing actually matters, working on python code with someone else sometimes causes issues if you are a tabber vs a spacer. But yeah, python had set notation long before modern JS actually did which was pretty awesome. Even now for heavy set work I prefer python’s syntax.
1 reply
0 recast
1 reaction

Brian Kim pfp
Brian Kim
@brianjckim
check out https://github.com/astral-sh/uv
0 reply
0 recast
1 reaction