Comments on Russell's python coding document:

1/ I think that the 79 character rule is a relict of vt100s and it's
time to move on.  We used 109 in Pan-STARRS and I certainly find
it hard to go back to 79.  If we do, then the indent of 4 spaces
is probably too many; 3 is perfectly readable (and 2's OK).

I think that we certainly need to increase the ratio
        LineLength/IndentWidth

2/ The whitespace looks fine, Except that I'd use white space to
indicate operator priority: Specifically, no white space around
operators that bind at least as hard as *.  This implies
          hypot2 = x*x + y*y

Russell's already doing this when he forbids space before the ( of a
function call --- it's easier to read
        sqrt(2) than
        sqrt (2)

3/ I think that we need to specify an indent column for inline
comments.  I used 40 for Pan-STARRS.

4/ Russell writes:
> Module names are mapped to file names, so always assume a
> case-sensitive file system and use the case that matches the file
> name in import statements.

This says, "Use the same case as the filesystem".  In addition,
we should assume a case _insensitive_ filesystem when naming
files!  Some filesystems [e.g. the one that I'm typing this on]
don't distinguish Name and name.

5/ We need to think about what exceptions we'll be raising.  I don't
think that we want every module raising its own derived exceptions
(am I wrong?).

6/ Russell writes:
> New in Python 2.5

Are we using 2.5, or sticking with 2.4 (2.3?).  I do NOT want to be
always chasing the bleeding edge.

7/ Russell writes:
> Use ''.startswith() and ''.endswith() instead of string slicing

I would personally prefer to always use re.search()
   re.search(r"^prefix", str)
as it's
   a. Standard
   b. Extensible


                                R

_______________________________________________
LSST-data mailing list
[email protected]
http://www.lsstmail.org/mailman/listinfo/lsst-data

Reply via email to