TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Python's None problem, and how Mypy helps you deal with it

4 pointsby jrheardover 3 years ago

1 comment

uniqueuidover 3 years ago
Typing is a great addition to Python, but despite all the effort, it&#x27;s still a band-aid. It doesn&#x27;t ultimately solve the issue with checking single return values and&#x2F;or exceptions.<p>I&#x27;m in awe every time I see how elegant this is in Erlang&#x2F;Elixir:<p><pre><code> case HTTPoison.get(url) do {:ok, %HTTPoison.Response{body: body, status_code: 200}} -&gt; IO.puts body {:error, %HTTPoison.Error{reason: reason}} -&gt; IO.inspect reason end </code></pre> Pattern matching on return tuples is really amazing.