python

Back Open Paginator
09.03.2026 15:17
h4ckernews (@h4ckernews@mastodon.social)

Python's Lazy Imports: Why It Took Three Years and Two Attempts

techlife.blog/posts/the-story-




Show Original Post


09.03.2026 15:15
r (@r@fed.brid.gy)

#python #brain_use Found this hidden gem in one of old @nedbat.com@bsky.brid.gy's blog posts [1] when collecting links to share in a rant on why the test dirs should have coverage measured (and the proper use of pragmas et al for getting to that stable coverage 100% metric):




Show Original Post


09.03.2026 15:15
r (@r@fed.brid.gy)

#python #brain_use [1] nedbatchelder.com/blog/200710/...




Show Original Post


09.03.2026 15:15
r (@r@fed.brid.gy)

> [..] tools are only helpful if they’re used to enhance thought, not replace it [..] Kinda echoes what @bdraco.org and I have been discussing regarding modern tooling (you know which one I'm implying!) #python #brain_use




Show Original Post


09.03.2026 14:56
CuratedHackerNews (@CuratedHackerNews@mastodon.social)

Python's Lazy Imports: Why It Took Three Years and Two Attempts

techlife.blog/posts/the-story-




Show Original Post


09.03.2026 14:53
lwn (@lwn@fedi.lwn.net)

[$] Inspecting and modifying Python types during type checking

Python has a unique approach to static typing. Python programs can contain type annotations, and even access those annotations at run time, but the annotations aren't evaluated by [...]

lwn.net/Articles/1061083/ #LWN #Linux #Python #Zig




Show Original Post


09.03.2026 14:30
Reuven (@Reuven@fosstodon.org)

Iran's will attack ships in the Strait of Hormuz, and oil prices are spiking! 🛢️💰📈

How much oil does Iran produce? How about other countries? How much oil is exported, vs. kept for domestic use?

Bamboo Weekly challenges you to answer these using #Python and #Pandas.

Check it out at BambooWeekly.com





Show Original Post


09.03.2026 13:25
tchauhan (@tchauhan@mastodon.mit.edu)

Do you use an LSP for python ? If so, which one ?

I just discovered basedpyright. NUTS. It is hands down the best open source experience I have had developing in this infuriatingly promiscuous language with no concern for runtime safety (I understand the historical reasons... I am just sad it has become the defacto standard for my field).

#python #languageserverProtocol #lsp #emacs #basedPyright

pylsp (python-lsp-server)
pyright
basedpyright
pylance
Other (please tell us more!)




Show Original Post


09.03.2026 13:10
mopicmp (@mopicmp@mastodon.social)

Python Tip: defaultdict Magic

from collections import defaultdict
groups = defaultdict(list)
for item in data:
groups[item.category].append(item)
# No KeyError, auto-creates lists

defaultdict creates missing keys automatically. No more 'if key not in dict' checks.

raccoonette.gumroad.com/l/Pyth




Show Original Post


09.03.2026 13:10
mopicmp (@mopicmp@mastodon.social)

Python Tip: Unpacking with *

first, *middle, last = [1, 2, 3, 4, 5]
# first=1, middle=[2,3,4], last=5

Star unpacking captures multiple values into a list. Works with any iterable.

raccoonette.gumroad.com/l/Pyth




Show Original Post


09.03.2026 12:46
riverfount (@riverfount@bolha.us)

Sets em Python: muito mais que remover duplicatas 🐍

Acabei de publicar um deep dive completo sobre sets — a estrutura de dados que a maioria dos engenheiros Python subestima.

Aprenda:
• Por que `if x in set` é O(1) e `if x in list` é O(n)
• Operações de conjunto em produção (união, interseção, diferença)
• Frozenset: quando você precisa de imutabilidade
• Casos reais: grafos, cache, detecção de anomalias

Esse é o tipo de conhecimento que transforma seu código de "funciona" para "funciona RÁPIDO".

Leia o artigo completo:
riverfount.dev.br/posts/sets_e

Dúvidas ou sugestões? Responde aqui! 🚀

#Python #DataStructures #Performance #Algorithms #DSA #Engineering




Show Original Post


09.03.2026 12:20
GripNews (@GripNews@mastodon.social)

🌘 解鎖 Python 核心:移除全域直譯器鎖(GIL)後的硬體利用率與能耗影響
➤ 效能與代價的博弈:無 GIL Python 環境的實證分析
arxiv.org/abs/2603.04782
Python 的全域直譯器鎖(GIL)長期以來限制了多核心 CPU 的並行處理能力。隨著 Python 3.13 引入實驗性的無 GIL 模式,本研究針對 Python 3.14.2 進行了深入評測。作者透過比較標準版與無 GIL 版本在四種不同工作負載(包含 NumPy、序列化核心、執行緒數值計算及物件操作)下的表現,揭示了一個關鍵事實:移除 GIL 並非萬靈丹。對於可高度並行的運算,執行效能提升顯著且節能;但對於序列化任務或涉及高度物件競爭的執行緒,則會導致能耗增加及記憶體負擔。這項研究為開發者選擇合適的執行環境提供了重要的效能評估指標。
+ 這篇研究非常及時。我們團隊原本打算全面升級至無 GIL 模式,看來現在得先針對物件操作密集型的任務進行壓力測試了,否則反倒會造成效能退化。
+ 很有趣,原來無
#電腦科學 #高效能運算 #Python 程式語言 #軟體效能分析




Show Original Post


1 ...356 357 358 359 360 361 362 363 364 365 366 ...1592
UP