Difference between revisions of "Python"

From Healthcare Robotics Wiki
Jump to: navigation, search
(HRL Coding Standards)
Line 14: Line 14:
 
   def my_function(a, b):
 
   def my_function(a, b):
 
       return b*a
 
       return b*a
 
  
 
== learning python ==
 
== learning python ==

Revision as of 21:28, 20 November 2009

HRL Coding Standards

  • In general, we follow the official python coding standards (Python standards) but we will summarize here the relevant key points.
    • Every indent is 4 spaces, replace all tabs with spaces.
    • ClassName, method_name, _private_name
    • Use classes sparingly, please try to define functions whenever possible.
    • Instead of using inheritance, use duck typing (i.e. define interfaces based on conventions)
    • With numpy, use matrices instead of arrays, all vectors should be column vectors.
    • We use doxygen styled comments:
 ##
 # some comments
 # @param a is 3x1 point in coordinate frame C
 # @param b is a 3x3 rotation matrix
 # @return a 3x1 vector rotated by b
 def my_function(a, b):
     return b*a

learning python

math, science, numerical, etc.

opencv

efficiency