[Twisted-Python] Re: [Twisted-commits] CVS: Twisted/twisted/protocols basic.py,1.13,1.14
![](https://secure.gravatar.com/avatar/7b5d5760f7eb6fb775f45b41fbf1e6b2.jpg?s=120&d=mm&r=g)
Itamar Shtull-Trauring wrote:
May I add something to the coding standard regarding this? Index: doc/CodingStandard.html =================================================================== RCS file: /cvs/Twisted/doc/CodingStandard.html,v retrieving revision 1.5 diff -c -r1.5 CodingStandard.html *** doc/CodingStandard.html 2001/10/26 16:33:19 1.5 --- doc/CodingStandard.html 2001/10/29 15:13:53 *************** *** 219,224 **** --- 219,239 ---- function, class, method, or module, make sure that it won't instantly break other code. </p> + <p> + If your class has attributes that are intended to be private and + implementation specific (e.g. the current state of a state-machine), + prefix your attribute with __. This will make sure that they don't + interfere with subclasses' attributes by mistake. For example: + <pre> + class Foo: + + __state = 1 + + def doSomething(self): + # ... + self.__state = 2 + </pre> + </p> <hr> <address><a href="mailto:glyph@helix.twistedmatrix.com">Glyph Lefkowitz</a></address> <!-- Created: Thu Apr 26 07:53:26 CDT 2001 -->
participants (1)
-
Itamar Shtull-Trauring