# X, y = 1, 2, 3 doesn't raise error? Neither does x, = 3

**URL:** <https://discourse.julialang.org/t/x-y-1-2-3-doesnt-raise-error-neither-does-x-3/1716>\
**Category:** General Usage\
**Tags:** question\
**Created:** [January 27, 2017, 3:52pm UTC](https://discourse.julialang.org/t/x-y-1-2-3-doesnt-raise-error-neither-does-x-3/1716 "2017-01-27T15:52:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![FANG\_Colin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fang_colin/32/170_2.png) [@FANG\_Colin](https://discourse.julialang.org/u/FANG_Colin)\
**Post date:** [January 27, 2017, 3:52pm UTC](https://discourse.julialang.org/t/x-y-1-2-3-doesnt-raise-error-neither-does-x-3/1716/1 "2017-01-27T15:52:04Z")

</div>

`x, y = 1, 2, 3` behaves the same as `x, y = 1, 2`

Also `x, = 3` behaves the same as `x = 3`

Are they a feature?

In python both would trigger exceptions, which I think is better.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 27, 2017, 3:58pm UTC](https://discourse.julialang.org/t/x-y-1-2-3-doesnt-raise-error-neither-does-x-3/1716/2 "2017-01-27T15:58:39Z")

</div>

Yes, this is a feature. Not sure which is better.

---

<div class="post-metadata">

**Author:** ![mbaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbaz/32/17295_2.png) [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Post date:** [January 27, 2017, 4:39pm UTC](https://discourse.julialang.org/t/x-y-1-2-3-doesnt-raise-error-neither-does-x-3/1716/3 "2017-01-27T16:39:46Z")

</div>

One arguable benefit of this syntax is that one can easily discard unneeded function return values:

```
julia> f()=(1,2,3);
julia> x,=f();
julia> x
1

```

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [January 27, 2017, 4:45pm UTC](https://discourse.julialang.org/t/x-y-1-2-3-doesnt-raise-error-neither-does-x-3/1716/4 "2017-01-27T16:45:43Z")

</div>

`x, = 3` works because numbers are iterable. There’s a concurrent discussion about that: [Numbers as single-element collections](https://discourse.julialang.org/t/numbers-as-single-element-collections/1621)

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [January 27, 2017, 6:36pm UTC](https://discourse.julialang.org/t/x-y-1-2-3-doesnt-raise-error-neither-does-x-3/1716/5 "2017-01-27T18:36:14Z")

</div>

I definitely see the current behavior as an advantage. It means, among other things, that I can add more outputs to an existing function, without breaking all code that calls that function.

I do this frequently in Matlab, and expect that it will happen with Julia too.

---

<div class="post-metadata">

**Author:** ![jrevels](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jrevels/32/10393_2.png) [@jrevels](https://discourse.julialang.org/u/jrevels)\
**Post date:** [January 27, 2017, 6:41pm UTC](https://discourse.julialang.org/t/x-y-1-2-3-doesnt-raise-error-neither-does-x-3/1716/6 "2017-01-27T18:41:39Z")

</div>

Also see [https://github.com/JuliaLang/julia/issues/18312](https://github.com/JuliaLang/julia/issues/18312).
