pitivi r1444 - trunk/docs



Author: edwardrv
Date: Wed Dec  3 17:26:26 2008
New Revision: 1444
URL: http://svn.gnome.org/viewvc/pitivi?rev=1444&view=rev

Log:
docs/HACKING: add more information on coding style

Modified:
   trunk/docs/HACKING

Modified: trunk/docs/HACKING
==============================================================================
--- trunk/docs/HACKING	(original)
+++ trunk/docs/HACKING	Wed Dec  3 17:26:26 2008
@@ -14,21 +14,28 @@
 
 - for callbacks, the name of the methods used should:
   - follow same conventions as normal method names
-  - be prepended with an underscore
+  - be prepended with two underscores since it's private
   - be appended with Cb
   Ex :
 
   class MyClass:
 
      def someMethod(self):
-         self.someobject.connect('event', self._someObjectEventCb)
+         self.someobject.connect('event', self.__someObjectEventCb)
 
-     def _someObjectEventCb(self, object, arg):
+     def __someObjectEventCb(self, object, arg):
          print "our callback was called"
 
 - for function names, we use the small_caps_with_underscore style.
   This enables clear separation between functions and methods.
 
+- for other class attributes we use the same calling convention as
+  for functions:
+  Ex : @property
+       def water_level(self):
+          """ The level of the water in meters"""
+          return self.__water_level
+
 - unused arguments in method should be prefixed by 'unused_'.
   The most common place where this would happen is in callbacks from gobject
   signals:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]