What's wrong with this code snippet?

LordLaraby Lord.Laraby at gmail.com
Sat Jan 7 02:06:52 EST 2006

For what it's worth, GenerateRandomColour does not access any instance
variables and therefore needn't even be a member of the class
Population. If you wanted it there for encapsulation purposes, consider
making it a staticmethod like so:

    def GenerateRandomColour():
        colour = rn.choice(['C', 'P', 'Z'])
        return colour 

Just something to consider...


More information about the Python-list mailing list