durusmail: quixote-users: Accessor methods and ZODB
Accessor methods and ZODB
2004-03-25
2004-03-25
2004-03-26
2004-03-26
2004-03-26
Re: Accessor methods and ZODB
2004-03-26
Accessor methods and ZODB
John J Lee
2004-03-26
On Fri, 26 Mar 2004, John J Lee wrote:

> On Wed, 24 Mar 2004, Daniel Potter (Ars Analytica) wrote:
>
> > One uses .set_x(y) to avoid typos which create a new
> > variable instead of doing the assignement intended.
> >
> > In the case of Dulci (in particular the places that
> > use ZODB) the use the .set_x(y) formalism to allows
> > one to do some type checking.
> [...]
>
> Of course, the same issues apply for all Python code, but perhaps data
> integrity changes things in favour of accessor methods.

...and of course, it's quite possible to do type checking on attribute
access, just more convenient to do it in a method (the same goes for
accidental attribute creation).

Since my test-first habits have temporarily fallen by the wayside while
getting to know quixote, I'm not in a position to argue about the reality
(or otherwise) of the benefits of .set_x(y) vs. .x = y ;-)


John


reply