On 10/12/2010 09:14 PM, Seebs wrote:
http://github.com/wrpseudo/pseudo/blob/master/makewrappers
Just a few pointers, looks quite good to me for a newbie :)
* Less action in __init__.
* Use `open` instead of `file` to open a file
* Have a look at context managers for file handling (avoids doing
error-prune stuff like __del__)
* Your `del` in line 464 is useless. A reference will be removed from
the object bound to the local variable 'source' anyway because of the
re-assignment.
* according to common Python style guides you should not use underscores
in class names.
* no need for 'r' in `open` calls ('r' is the default mode)
* `line == ''` can be written more pythonic as `not line`
* `str.{r,l,}strip` removes '\n\t\r ' by default, no need for an
argument here (line 440 for example)
* you might want to pre-compile regular expressions (`re.compile`)
* raising `Exception` rather than a subclass of it is uncommon.
Hope that helps :-)
Jonas
--
http://mail.python.org/mailman/listinfo/python-list