In writing modules for python code to improve readability and portability, is it better practice to write methods or variables for simple return values? Why? Do python methods utilize more space in memory or do variables?
In practice it doesn't change much... module.item()
vs module.item
Note: Consider readability of code that would be written using the module. Not the readability in the module itself.
For example:
#colors.py
def red():
return [255,0,0]
def green():
return [0,255,0]
def blue():
return [0,0,255]
VS
#colors.py
red = [255,0,0]
green = [0,255,0]
blue = [0,0,255]