# Why \[(a = 1, b = 3), (a = 3, b = 4)\] isa Vector{NamedTuple} -\> false?

**URL:** <https://discourse.julialang.org/t/why-a-1-b-3-a-3-b-4-isa-vector-namedtuple-false/102981>\
**Category:** General Usage\
**Created:** [August 19, 2023, 11:51am UTC](https://discourse.julialang.org/t/why-a-1-b-3-a-3-b-4-isa-vector-namedtuple-false/102981 "2023-08-19T11:51:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrey2185](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrey2185/32/9889_2.png) [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Post date:** [August 19, 2023, 11:51am UTC](https://discourse.julialang.org/t/why-a-1-b-3-a-3-b-4-isa-vector-namedtuple-false/102981/1 "2023-08-19T11:51:14Z")

</div>

hello! why ?  
`[(a = 1, b = 3), (a = 3, b = 4)] isa Vector{NamedTuple} # -> false`

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [August 19, 2023, 12:18pm UTC](https://discourse.julialang.org/t/why-a-1-b-3-a-3-b-4-isa-vector-namedtuple-false/102981/2 "2023-08-19T12:18:23Z")

</div>

Because `NamedTuple` is ~~an abstract type~~ not a concrete type, and your array is an array of concrete named-tuples of the same type. So, it is not an array of that ~~abstract types~~ `NamedTuple` in general, but an array where the elements are subtypes of `NamedTuple`. Therefore:

```julia
julia> [(a = 1, b = 3), (a = 3, b = 4)] isa Vector{<:NamedTuple}
true

```

And of course, it is an array of the concrete type specifically:

```julia
julia> typeof((a = 1, b = 3))
@NamedTuple{a::Int64, b::Int64}

julia> [(a = 1, b = 3), (a = 3, b = 4)] isa Vector{@NamedTuple{a::Int64, b::Int64}}
true

```

And, finally, you could create an array supporting general named tuples, by annotating that explicitly:

```julia
julia> NamedTuple[(a = 1, b = 3), (a = 3, b = 4)] isa Vector{NamedTuple}
true

```

---

<div class="post-metadata">

**Author:** ![mohamed.d180](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed.d180/32/52028_2.png) [@mohamed.d180](https://discourse.julialang.org/u/mohamed.d180)\
**Post date:** [August 19, 2023, 12:32pm UTC](https://discourse.julialang.org/t/why-a-1-b-3-a-3-b-4-isa-vector-namedtuple-false/102981/3 "2023-08-19T12:32:21Z")

</div>

Is not NamedTupel is a UnionAll not abstract type?

```julia
julia> NamedTuple |> isabstracttype
false

julia> NamedTuple isa UnionAll
true

```

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [August 19, 2023, 12:34pm UTC](https://discourse.julialang.org/t/why-a-1-b-3-a-3-b-4-isa-vector-namedtuple-false/102981/4 "2023-08-19T12:34:47Z")

</div>

Yes, right (although the idea is the same there). I’ll edit the post to remove the reference to abstract types.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [August 19, 2023, 12:44pm UTC](https://discourse.julialang.org/t/why-a-1-b-3-a-3-b-4-isa-vector-namedtuple-false/102981/5 "2023-08-19T12:44:22Z")

</div>

Also if you wanted to check if a vector has an element type of some kind of `NamedTuple` then use the following expression.

```julia
julia> [(a = 1, b = 3), (a = 3, b = 4)] isa Vector{<: NamedTuple}
true

```
