Le mercredi 12 juillet 2006 11:17, mystilleef a écrit : > Yes, it is possible to name crappy accessors too (e.g set_tmp/get_tmp). > But developers tend to pay more attention to given methods/functions > less crappy names, at least when compared to data attributes. Not python developers.
> This > stems from the fact that in many languages data attributes aren't > usually part of the API, as well as the whole OO(Encapsulation) blah > blah. I know I would not name the accessors set_tmp/get_tmp, because my > philosophy is that methods/functions need to have meaningful names and > state their intended purpose. But that's not python philosophy. > I don't hold data attributes to such > standards and I imagine many developers don't either and least based on > other people's code I've read. Plus there are many occassions when > attributes are not intended to be APIs, but eventually become one. But they are in Python and that is the python's philosophy. All attribute or method not beginning with an '_' *is* API. > After all most data attributes are created with the purpose of serving > methods. And in python the reverse can be true : class a(object) : def __init__(self, ro_attr) : self.__attr = ro_attr def _getAttr(self) : """A method which serves an attribute""" return self.__attr attr = property(_getAttr) -- _____________ Maric Michaud _____________ Aristote - www.aristote.info 3 place des tapis 69004 Lyon Tel: +33 426 880 097 -- http://mail.python.org/mailman/listinfo/python-list