JuliaLang/julia

Add `haskey` for `Tuple`

Open

#35,516 opened on 2020年4月18日

GitHub で見る
 (7 comments) (2 reactions) (0 assignees)Julia (5,773 forks)batch import
collectionsgood first issue

Repository metrics

Stars
 (48,709 stars)
PR merge metrics
 (平均マージ 20d 6h) (30d で 157 merged PRs)

説明

Currently haskey is defined for NamedTuple but not for Tuple. Would it make sense to also add this for tuples? After all, keys(::Tuple) is also defined.

Code would then probably look like this

    haskey(t::Tuple, key) = isdefined(t, key)

Related: https://github.com/JuliaLang/julia/issues/32898

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