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
David Binger
2004-03-25
Hi John,

Direct attribute access is safe and fast, and you can use it with no
worries.
The pattern you have noticed is just the pattern we like these days.
The general pattern is that outside users of a class should normally
interact with the class through methods (those whose names do not
start with underscore).  The advantage of this is that the API is not
pickled into the database.    This makes it a bit easier to change
names used for methods and for attributes, as we do sometimes.

David

On Mar 24, 2004, at 7:02 PM, John J Lee wrote:

> Dulcinea and its example app, Toboso, seem to consistently use accessor
> methods .get_x() / .set_x(y), in place of the popular Python
> convention of
> just using 'direct' attribute access .x / .x = y.
>
> Why is this done?  Is it a hold-over from older versions of the ZODB,
> or
> is there some current reason for it?
>
> I've followed this convention in my own code, but mostly out of
> paranoia.
>
>
> John
>
> _______________________________________________
> Quixote-users mailing list
> Quixote-users@mems-exchange.org
> http://mail.mems-exchange.org/mailman/listinfo/quixote-users



reply