﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13408	Unpacking list/tuple in for loop should raise exception on unpacking if length is different	Peter Bengtsson	Ivan Kolodyazhny	"In Python and Django you can do this:

{{{
points_3d = [(1,1,1), (2,2,0), ]

# python
for x, y, z in points_3d:
    pass

# django template
{% for x, y, z in points_3d %}
{% endfor %}
}}}

However, in Python you '''can't''' do this 
{{{
for x, y in points_3d:
ValueError: too many values to unpack

# or

for x, y, z, w in points_3d:
ValueError: need more than 3 values to unpack
}}}

BUT Django allows it and doesn't raise a {{{ValueError}}} and I think this is bad. It allows you to do this:

{{{
{% for x, y, z, w in points_3d %}
  no probs :(
{% endfor %}
}}}

It lends itself to invalid and ""incorrect"" template code which can potentially hide programming mistakes that come back and bite you later. "	Bug	closed	Template system	dev	Normal	fixed		peter@…	Accepted	1	1	0	1	0	0
