On Sun, Nov 14, 2010 at 11:20 AM, Chris Rebert <c...@rebertia.com> wrote:
> On Sun, Nov 14, 2010 at 11:00 AM, Micah Carrick <mi...@greentackle.com> > wrote: > > I'm writing a little API that other people will use. There are up to 3 > > "objects" that get passed around. One of them has some validation > methods, > > the other two simply store data and probably won't have any validation or > > other methods. I only made them objects so that they are syntactically > (is > > that a word?) similar the other object rather than using dictionaries. I > > figure it also better allows for changes in the future. > > > > Any thoughts on the pros/cons of using my own objects over a dictionary > > objects? > > Objects are definitely nicer to work with syntactically, and they help > make your program's types more explicit. > Rather than coding the "data holder" classes manually, consider using > namedtuples instead: > http://docs.python.org/library/collections.html#collections.namedtuple > namedtuples are nice, but I don't think pylint understands how to look inside them as well as it understands how to look inside class instances. pylint isn't for everyone, but I find it very useful in producing sturdy python code with few surprises at runtime.
-- http://mail.python.org/mailman/listinfo/python-list