Another Sets Problem
MRAB
python at mrabarnett.plus.com
Tue Dec 29 11:11:45 EST 2009
Victor Subervi wrote:
> On Mon, Dec 28, 2009 at 4:23 PM, Steve Holden <steve at holdenweb.com
> <mailto:steve at holdenweb.com>> wrote:
>
[snip]
>
> Boy, does it! It looks great...on paper. Here's some revised code to debug:
>
> # print 'XXX', types[x]
> elif types[x][0:3] == 'set':
> for f in field:
> print '<td>AAA%s</td>\n' % (field)
> else:
> print 'YYY'
>
> 1) If I uncomment the commented line, it throws this error:
>
> [Tue Dec 29 00:58:10 2009] [error] [client 208.84.198.58] File
> "/var/www/html/angrynates.com/cart/enterProducts2.py
> <http://angrynates.com/cart/enterProducts2.py>", line 138, referer:
> http://angrynates.com/cart/enterProducts.py
> [Tue Dec 29 00:58:10 2009] [error] [client 208.84.198.58] elif
> types[x][0:3] == 'set':, referer:
> http://angrynates.com/cart/enterProducts.py
> [Tue Dec 29 00:58:10 2009] [error] [client 208.84.198.58] ^,
> referer: http://angrynates.com/cart/enterProducts.py
> [Tue Dec 29 00:58:10 2009] [error] [client 208.84.198.58] SyntaxError:
> invalid syntax, referer: http://angrynates.com/cart/enterProducts.py
> [Tue Dec 29 00:58:10 2009] [error] [client 208.84.198.58] Premature end
> of script headers: enterProducts2.py, referer:
> http://angrynates.com/cart/enterProducts.py
>
Incorrect indentation (later versions of Python give a better error
message).
> 2) AAA prints out before the following fields:
> AAASet(['Extra-small'])
> AAASet(['purple:50404D'])
>
> 3) YYY *also* prints out twice!!
>
[snip]
In a for...else... structure it will execute the 'else' part unless it
'break's out of the 'for' loop, which it doesn't here.
More information about the Python-list
mailing list