On Mon, Oct 25, 2010 at 6:49 PM, Shlomi Fish <[email protected]> wrote:

>
> > I have a few general notes:
> >
> >    1. Use new-style classes. (Inherit every class from `object`.)
>
> What does that give me? Is it compatible with older versions of python?
>

Here's a piece by Guido:
http://python-history.blogspot.com/2010/06/new-style-classes.html

And a StackOverflow question:
http://stackoverflow.com/questions/54867/old-style-and-new-style-classes-in-python

Old-style classes are deprecated and you should never use them.

About compatibility: I think new-style classes go back to Python 2.2.

>    2.
> >
> >    '''The solver instance itself.''' This docstring doesn't help much.
> > I wouldn't use the word instance other, you know that word is used for
> > actual objects.
>
> Fixed.
>
> >
> >    3.
> >
> >    '''A class method that parses the input file and constructs an
> > object.'''. I think this is bad writing style. Much better would be
> > '''Parse the input file and create a Solver.'''
> >
>
> Fixed, thanks.
>
> >
> > 'I don't know if you read them, but you should be familiar with PEP 8
> > <http://www.python.org/dev/peps/pep-0008/> and PEP 257
> > <http://www.python.org/dev/peps/pep-0257/>. (I don't follow them
> > completely and you don't have to follow them completely either, but in
> > most things they are good.)
>
> OK, I'll take a look when I have some spare cycles.
>
> >
> >
> > I want to note that most of the advice I gave here is about style; I
> > understand if it's not that important to you. I personally care a lot
> > about style, but many Python programmers don't. You can decide
> > yourself which path you want to follow.
>
> OK, I care about style when it gets in the way of understanding or using
> the
> code. But see:
>
> http://www.joelonsoftware.com/articles/Wrong.html


Thanks for the article.


Ram.
_______________________________________________
Python-il mailing list
[email protected]
http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il

לענות