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

Martin Falatic martin at falatic.com
Fri Jul 25 20:14:21 CEST 2014


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




More information about the Baypiggies mailing list