TypeError: int argument required

Bearophile bearophileHUGS at lycos.com
Mon Jun 15 09:23:47 EDT 2009


Lawrence D'Oliveiro:
>So no, using alternative quotes does not make things more readable.<

You think that this:

'<rect x="%f" y="%f" width="%d" height="%d"
style="fill:blue;stroke:pink;stroke-width:5;fill-opacity:0.1;stroke-
opacity:0.9"/> '

Isn't a bit more readable and simpler to write than:

"<rect x=\"%f\" y=\"%f\" width=\"%d\" height=\"%d\"
style=\"fill:blue;stroke:pink;stroke-width:5;fill-opacity:0.1;stroke-
opacity:0.9\"/> "

I think lot of doesn't agree with you.


In such situation it can also be positive to split such string in two
or more parts, for example (untested):

style = ("fill:blue; stroke:pink; stroke-width:5; "
         "fill-opacity:0.1; stroke-opacity:0.9")

print >> fo, '<rect x="%f" y="%f" width="%d" height="%d" style="%s"/>
' % (abs_x, abs_y, w, h, style)

Bye,
bearophile



More information about the Python-list mailing list