frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Ask HN: Why dead code detection in Python is harder than most tools admit

4•duriantaco•14h ago
I’ve been thinking about why dead code detection (and static analysis in general) feels so unreliable in Python compared to other languages. I understand that Python is generally dynamic in nature.

In theory it should be simple(again in theory): parse the AST, build a call graph, find symbols with zero references. In practice it breaks down quickly because of many things like:

1. dynamic dispatch (getattr, registries, plugin systems)

2. framework entrypoints (Flask/FastAPI routes, Django views, pytest fixtures)

3. decorators and implicit naming conventions

4. code invoked only via tests or runtime configuration

Most tools seem to pick one of two bad tradeoffs:

1. be conservative and miss lots of genuinely dead code

or

2. be aggressive and flag false positives that people stop trusting

What’s worked best for me so far is treating the code as sort of a confidence score, plus some layering in limited runtime info (e.g. what actually executed during tests) instead of relying on 100% static analysis.

Curious how others handle this in real codebases..

Do yall just accept false positives? or do yall ignore dead code detection entirely? have anyone seen approaches that actually scale? I am aware that sonarqube is very noisy.

I built a library with a vsce extension, mainly to explore these tradeoffs (link below if relevant), but I’m more interested in how others think about the problem. Also hope I'm in the right channel

Repo for context: https://github.com/duriantaco/skylos

Ask HN: Is there anyone here who still uses slide rules?

95•blenderob•3h ago•96 comments

Ask HN: Who wants to be hired? (February 2026)

126•whoishiring•1d ago•347 comments

Ask HN: Do you still use physical calculators?

52•speedylight•3d ago•112 comments

Ask HN: Who is hiring? (February 2026)

297•whoishiring•1d ago•383 comments

Signal Is Down

33•Daniel_sk•1h ago•10 comments

Ask HN: Anyone have a "sovereign" solution for phone calls?

4•kldg•5h ago•0 comments

Kernighan on Programming

156•chrisjj•1d ago•52 comments

Ask HN: OpenClaw users, what is your token spend?

11•8cvor6j844qw_d6•17h ago•4 comments

Ask HN: Have you been fired because of AI?

8•s-stude•11h ago•13 comments

Best practices for powering and wiring addressable LED strip installs?

2•emmasuntech•8h ago•0 comments

My small SaaS got recommended my Google in the AI search overview

2•kaave•8h ago•2 comments

Ask HN: What weird or scrappy things did you do to get your first users?

12•preston-kwei•18h ago•6 comments

Ask HN: Where do all the web devs talk?

53•LinguaBrowse•14h ago•49 comments

GitHub Actions Have "Major Outage"

52•graton•21h ago•15 comments

Ask HN: Why dead code detection in Python is harder than most tools admit

4•duriantaco•14h ago•0 comments

CiderStack – Native macOS VM manager, pay once, no subscription

4•ciderdev•10h ago•2 comments

Google Cloud suspended my account for 2 years, only automated replies

156•andylizf•2d ago•90 comments

Ask HN: Are you still using spec driven development?

3•cherry_tree•16h ago•1 comments

Ask HN: Request limits vs. token limits for AI-powered apps?

2•JeduDev•13h ago•0 comments

Ask HN: Is anyone losing sleep over retry storms or partial API outages?

2•rjpruitt16•13h ago•4 comments

Ask HN: Has anybody moved their local community off of Facebook groups?

20•madsohm•1d ago•14 comments

Ask HN: Anyone else struggle with how to learn coding in the AI era?

42•44Bulldog•14h ago•58 comments

Ask HN: Interest in low cost / fast container registry?

2•osigurdson•15h ago•0 comments

Latex-wc: word count and word frequency for LaTeX projects

2•sethbarrettAU•16h ago•2 comments

Ask HN: A proposal for interviewing "AI-Augmented" Engineers

3•vanbashan•16h ago•1 comments

Ask HN: Who is firing? (February 2026)

22•chalmovsky•18h ago•3 comments

Why do people still talk about AGI?

41•cermicelli•1d ago•59 comments

Ask HN: Why are customer feedback boards so static? Building a live alternative

2•develotor•18h ago•2 comments

Ask HN: What are the immediate/near/long-term non-corporate benefits of AI?

2•0x4e•18h ago•11 comments

Ask HN: Junior getting lost

49•TheRegularOne•4d ago•37 comments