Is this a strange Inconsistency or bug in Julia?

There is something odd about lists of symbols:

julia> for i in (1,2); println(i); end
1
2

julia> for i in (1); println(i); end
1

julia> for i in (:ab,:cd); println(i); end
ab
cd

julia> for i in (:ab); println(i); end
ERROR: MethodError: no method matching start(::Symbol)
Closest candidates are:
  start(::Core.SimpleVector) at essentials.jl:533
  start(::Base.MethodList) at reflection.jl:690
  start(::ExponentialBackOff) at error.jl:170
  ...
Stacktrace:
 [1] top-level scope at ./<missing>:?

the problem is that (:ab) is not (:ab,), and somehow this interferes with the in interpretation, but other types do not seem to have this problem.

/iaw

This works as intended; Numbers are iterable, Symbols are not.

1 Like