sharkdp/shell-functools

Handling of type-inference errors (file named `3`)?

Open

#19 geöffnet am 1. Apr. 2018

Auf GitHub ansehen
 (1 Kommentar) (1 Reaktion) (0 zugewiesene Personen)Python (52 Forks)github user discovery
help wantedquestion

Repository-Metriken

Stars
 (1.242 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

As we always read strings via stdin, we have to guess the type of each input line (via add_dynamic_type). This can lead to errors:

> touch a b
> ls | map filesize  # okay
> touch 3
> ls | map filesize  # Incompatible input type: expected 'Path', got 'Int'

How should we handle this? Add explicit type annotations? Always assume everything to be a string?

Contributor Guide