Settings

Theme

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

engineeringblog.ridereport.com

4 points by jrheard 4 years ago · 1 comment

Reader

uniqueuid 4 years ago

Typing is a great addition to Python, but despite all the effort, it's still a band-aid. It doesn't ultimately solve the issue with checking single return values and/or exceptions.

I'm in awe every time I see how elegant this is in Erlang/Elixir:

    case HTTPoison.get(url) do
      {:ok, %HTTPoison.Response{body: body, status_code: 200}} ->
        IO.puts body
      {:error, %HTTPoison.Error{reason: reason}} ->
        IO.inspect reason
    end

Pattern matching on return tuples is really amazing.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection