Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 129
PythonCodingConventions
Ben Toogood edited this page Jun 13, 2013
·
2 revisions
This simple class demonstrates the python coding conventions for Cortex. If this class were part of a Cortex python module, it would be stored in a file called "Logging.py" to match the name of the class that it defines.
importos, sysimporttracebackimportIECoreclassLogging :
LogLevel=IECore.Enum.Create( "NoLog", "Info", "Warning", "Error", "Debug", "VerboseDebug" )
def__init__( self ) :
# private members and methods use the "__" prefixself.__level=Logging.LogLevel.NoLog# protected members and methods use the "_" prefixself._initialized=True# public members and methods do not use a prefixself.previousLogLevel=None## This is the method description. As with C++, methods and arguments have lowerCamelCase names# and do not include under_scores.deflogMessage( self, someLevel, msg ) :
if ( someLevel>self.__level ) :
## \todo This is how to mark changes that need to take place at some point# in the future. Do not commit test/broken code that is commented out. Instead# leave it out and add a todo.sys.stderr.write( msg )
defsetLogLevel( self, level ) :
self.previousLogLevel=self.__levelself.__level=leveldefgetLogLevel( self ) :
returnself.__level- Introduction
- General Functionality
- Data Handling
- Parameters and Ops
- Point Primitives
- Mesh Primitives
- Image Primitives
- Procedurals
- Cortex & Python
- Cortex & Maya
- Cortex & Houdini