sharkdp/shell-functools

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

Open

#19 建立於 2018年4月1日

在 GitHub 查看
 (1 留言) (1 反應) (0 負責人)Python (52 fork)github user discovery
help wantedquestion

倉庫指標

Star
 (1,242 star)
PR 合併指標
 (PR 指標待抓取)

描述

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?

貢獻者指南