Skip to content

Coding style guide.

James Draper edited this page Oct 26, 2016 · 1 revision

Classes

Below is an example of a class with the minimum number of functions that should be incorporated in a class.

class Example:
    def __init__(self,data):
        self.data = data

    def addAttribute(self,attribute_name,attribute_data):
        self.__dict__[attribute_name] = attribute_data
        
    def __repr__(self):
        return "Attributes: "+", ".join(list(self.__dict__.keys()))
Clone this wiki locally