[LRUG] attr_accessor parsed as a method variable when setting with a get

Jordi Noguera Leon jordinoguera83 at gmail.com
Wed Sep 21 04:01:11 PDT 2011


>
> In Python once you've defined the setter, it automatically gets called on
> assignment. In other words, the syntax for calling the setter is identical
> to the syntax to setting the instance variable. This has always struck me as
> a brilliant piece of design. What's nice about that is you don't have some
> code calling the accessor, some code updating the instance variable
> directly, simply because people have different styles, preferences or
> expectations.
>

Except when you want to override a setter in Django... Then it's not nice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20110921/bc24f0cf/attachment-0003.html>


More information about the Chat mailing list