Python programmer 🐍, Rust apprentice 🦀 DevOps 🛠, PostgreSQL 🐘, Open source, 🪟 Windows Subsystem for Linux 🐧 user. 🤖 he/him

Europe
Joined July 2011
We are very exited to share with you PEP 768 🐍, which proposes a safe external debugger interface to Python. We think this is a really exciting change that will allow debuggers to safely attach to running Python processes without stopping them. 🐛🔨 peps.python.org/pep-0768/
3
30
6
203
11,679
I conducted an analysis of return-in-finally in real world Python code. TL;DR: - it is not used often - when it is used, it's usually used incorrectly - code authors find it easy to fix Full Report: github.com/iritkatriel/final…
6
12
2
49
10,995
Wait. That’s why it is called itertools.tee ?! 🤯
2
1
25
2,021
Max @tekknolagi just gave his presentation "Dr Wenowdis: Specializing dynamic language C extensions using type information" at Soap at PLDI in Copenhagen. The talk is about how to add type information to C extensions to speed them up in PyPy. Slides: bernsteinbear.com/assets/img…
3
8
23
1,647
Squeaky retweeted
how I squeeze 60K RPS out of SQLite on a $5 VPS: There are tons of tutorials on how to setup SQLite, and sometimes they contradict each other. Here is what worked for me. 1. Configuring PRAGMAs. We need to send the following PRAGMA commands right after opening the connection: PRAGMA journal_mode = WAL; - enables write-ahead log so that your reads do not block writes and vice-versa. PRAGMA busy_timeout = 5000; - sqlite will wait 5 seconds to obtain a lock before returning SQLITE_BUSY errors, which will significantly reduce them. PRAGMA synchronous = NORMAL; - sqlite will sync less frequently and be more performant, still safe to use because of the enabled WAL mode. PRAGMA cache_size = -20000; - negative number means kilobytes, in this case 20MB of memory for cache. PRAGMA foreign_keys = true; - because of historical reasons foreign keys are disabled by default, we should manually enable them. PRAGMA temp_store = memory; - moves temporary tables from disk into RAM, speeds up performance a lot. Do NOT use cache=shared! Some tutorials recommend configuring it, but this is how you get nasty SQLITE_BUSY errors. It is disabled by default, so you don't have to do anything extra. 2. Use immediate transactions If you know that transaction can possibly do a write, always use BEGIN IMMEDIATE or you can a get SQLITE_BUSY error. Check your framework, you should be able to set this at the connection level. 3. Open two connection pools Another trick is to open 2 connection pools, one for reads only and another for reads/writes. Set the connection limit of write pool to 1, and the connection limit of the read pool to some reasonably high number, e.g. number of your CPU cores. 4. Bonus: how I configure sqlite with Go Here is the code in go I use to configure the sqlite connections: ```go func SQLiteDbString(file string, readonly bool) string { connectionParams := make(url.Values) connectionParams.Add("_journal_mode", "WAL") connectionParams.Add("_busy_timeout", "5000") connectionParams.Add("_synchronous", "NORMAL") connectionParams.Add("_cache_size", "-20000") connectionParams.Add("_foreign_keys", "true") if readonly { connectionParams.Add("mode", "ro") } else { connectionParams.Add("_txlock", "IMMEDIATE") connectionParams.Add("mode", "rwc") } return "file:" + file + "?" + connectionParams.Encode() } func OpenSqliteDatabase(file string, readonly bool) (*sql.DB, error) { dbString := SQLiteDbString(file, readonly) db, err := sql .Open("sqlite3", dbString) pragmasToSet := []string{ "temp_store=memory", } for _, pragma := range pragmasToSet { _, err = db.Exec("PRAGMA " + pragma + ";") if err != nil { return nil, err } } if readonly { db.SetMaxOpenConns(max(4, runtime.NumCPU())) } else { db.SetMaxOpenConns(1) } return db, nil } ```
26
131
15
1,599
223,992
Just published a new blog post, talking about our real-life shenanigans with PostgreSQL statistics, indexes, and pareto data distributions: making.close.com/posts/diale… Discuss it here: news.ycombinator.com/item?id…
1
1
1
2
134
im ashamed nobody in 2022 said to me "wake up babe new SI prefixes dropped" ronna and quetta now exist and im 2 years late to it
67
549
90
5,238
145,731
Stick the following in your ~/.gitconfig to make `git branch` sort by most recently committed (thanks to @andywingo for this one!): [branch] sort = -committerdate
5
32
1,364
> Google has announced that starting in June 2024, ad blockers such as uBlock Origin will be disabled in Chrome 127 and later with the rollout of Manifest V3 Ah.
312
1,275
1,971
9,340
3,371,003
New blog post: The Return of the Frame Pointers (Fedora, Ubuntu) brendangregg.com/blog/2024-0…
17
182
16
781
114,226
Squeaky retweeted
Why did Apple and Google make it hard to switch default browsers for so many years? Because it's a powerful way to block competitors. Just look at what happened to Brave installs on iPhone in the EU when Apple rolled out a new default browser choice screen on March 6th:
124
323
113
2,244
602,551
ways to stay humble: - code - feel like god when something works - find bug - realize bug was your fault - repeat until you die
11
61
4
467
37,696
Open source AI foundation models will wipe out closed and proprietary AI models for the same reason Wikipedia wiped out generalist commercial encyclopedia: crowd-sourced human contributions to open platforms can cater to a high diversity of interests, cultures, and languages.
199
545
117
3,719
565,282
the problem is not dynamic typing - it's the obscene amounts of code that people write to do simplest things. if you keep simple things simple and avoid proliferating complexity then you would not need to create solutions for managing this complexity.
7
11
58
6,561
In the Cpython core dev sprint we have started a project to improve the CPython REPL for Python 3.13+ 🎉 The first achievement is showing proper exceptions with source, error messages and locations in the REPL tracebacks. You can compare the before and after in these images:
8
43
2
334
43,392
WOW! IT'S HAPPENING: the Steering Council posted their "intent to accept PEP 703", in other words to allow for a version of #Python without the #GIL. @colesbury's heroic effort to prove nogil is feasible will be paying off. Now the real work begins! discuss.python.org/t/a-steer… – at Poznan, Poland
16
205
34
853
108,722
The internet kinda sucks now. The same 4 companies are trying to just copy each other, Google Search returns garbage now, Reddit is ruined, ads are cancer, everything is blocked by paywalls or covered in auto-playing videos, algorithms are designed to waste your time, etc. ☠️
85
316
23
3,643
221,157