Allowing comments after the line continuation backslash

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Wed Nov 3 18:51:35 EDT 2010


In message <roy-DF73A5.08174603112010 at news.panix.com>, Roy Smith wrote:

>> <http://github.com/ldo/dvd_menu_animator>
> 
> That URL takes me to a github page.  Can you be more specific about
> which file I should be looking at?

The extract I previously quoted was from dvd_menu_animator.

> 2) You have provided comments for each function, such as (lines 36-37):
> 
> def NewLayer(svg, LayerName) :
>     # adds a new layer to the SVG document and returns it.
> 
> This is good, but would be even more useful if it were turned into a
> docstring ...

I am ambivalent about the usefulness of docstrings. I find them mainly handy 
in stuff imported from library modules, of which this is not one.

> 3) I find the deeply nested style you use very difficult to read.  For
> example, on lines 80-103.  As I read this, here's how I mentally process
> it:
> 
> "OK, here's a function call (minor stumble over the open paren not being
> on the same line as the function name, but I can get past that).  The
> first argument is TheLayer.  The second argument is whatever
> inkex.addNS() returns.  Umm..."

You’re looking at it wrong. It’s building a data structure to go into an SVG 
file. Think of each piece of the expression as directly mapping to the 
corresponding piece of the structure being built. The value being built for 
the “d” attribute is just a sequence of control points for the path.



More information about the Python-list mailing list