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? # this is what I have now... stuff = Stuff(foo="foo", bar="bar") if stuff.is_valid(): cust = Customer(name="John", email="f...@bar.com") order = Order(order_id=1234, amount=12.99) SomeObject.some_method(stuff, cust, order) # this would also work... stuff = Stuff(foo="foo", bar="bar") if stuff.is_valid(): cust = { 'name': "John", 'email': "f...@bar.com" } order = { 'order_id': 1234, 'amount': 12.99 } SomeObject.some_method(stuff, cust, order) -- Micah Carrick
-- http://mail.python.org/mailman/listinfo/python-list