Dict{String,Array{T,1}} where T; 与Dict{String,Array{T,1}where T}两种类型的区别
其中,
Dict{String,Array{T,1}} where T,只是说明这个数据类型,只能放一种具体的数据类型,比如Dict{String,Array{Int64,1}}或Dict{String,Array{String,1}},但不能都放;
Dict{String,Array{T,1}where T},却是表明,既可以Dict{String,Array{Int64,1}},也可以Dict{String,Array{String,1}};
julia> instrs = Dict("YLXF"=>[("IC","IH")],"XXXY"=>["IC"])
Dict{
String,Array{
T,1} where T} with 2 entries:
"XXXY" => ["IC"]
"YLXF" => [("IC", "IH")]
julia> s = Dict{
String,Array{
T,1} where T}() ;
julia> setindex!(s,["a"],"a")
Dict{
String,Array{
T,1} where T} with 1 entry:
"a" => ["a"]
julia> setindex!(s,[("a","b")],"b")
Dict{
String,Array{
T,1} where T} with 2 entries:
"b" => [("a", "b")]
"a" => ["a"]
julia> Dict{
String,Array{
T,1} where T} == Dict{
String,Array{
T,1}} where T
false
julia> A = Dict{
String,Array{
T,1}} where T
Dict{
String,Array{
T,1}} where T
julia> typeof(A)
UnionAll
julia> B = Dict{
String,Array{
T,1} where T}
Dict{
String,Array{
T,1} where T}
julia> typeof(B)
DataType