sharkdp/shell-functools

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

Open

#19 opened on 2018年4月1日

GitHub で見る
 (1 comment) (1 reaction) (0 assignees)Python (52 forks)github user discovery
help wantedquestion

Repository metrics

Stars
 (1,242 stars)
PR merge metrics
 (PR metrics pending)

説明

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?

コントリビューターガイド