[Tutor] Good approach regarding classes attributes

Joel Goldstick joel.goldstick at gmail.com
Mon Sep 8 05:08:50 CEST 2014


On Sun, Sep 7, 2014 at 11:01 PM, Danny Yoo <dyoo at hashcollision.org> wrote:
>>> @property
>>> def _avatar(self):
>>> return self._avatar
>
> Hi Joel,
>
> The above code looks strange to me.  The method and the field name
> should not use the same name.

ah! good catch Danny.  I didn't write it, I was commenting on the OP code.

But (and maybe this was discussed earlier in the thread), what value
is using the property decorator instead of just saving the data to
attributes?



-- 
Joel Goldstick
http://joelgoldstick.com


More information about the Tutor mailing list