[Baypiggies] The correct / consistent way to work with class attributes

Shannon -jj Behrens jjinux at gmail.com
Sat Jul 26 02:12:43 CEST 2014


Is there any case that using self.__class__.attribute doesn't address?


On Fri, Jul 25, 2014 at 11:14 AM, Martin Falatic <martin at falatic.com> wrote:

> My question on Stack Overflow is getting a lot of traffic but little love:
> http://stackoverflow.com/questions/24923749/
>
> Perhaps the more exact question after all that discussion is, what's the
> best (Pythonic and consistent) way to work with class attributes from
> within a given (new-style) class? type(self), self.__class__, the explicit
> class name, something else?
>
> It seems to me that putting the explicit class name into a class is
> redundant, and I was told meta-classes can cause issues with using type()
> when considering how Python 2.7 works versus 3.4 (I'm not as well versed
> on meta-classes yet so I'm not sure what the specific difference is
> supposed to be there - but I'd like to understand it).
>
> Thoughts?
>
>  - Marty
>
>
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> https://mail.python.org/mailman/listinfo/baypiggies
>



-- 
In this life we cannot do great things. We can only do small things with
great love. -- Mother Teresa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20140725/cef98945/attachment.html>


More information about the Baypiggies mailing list