Can I just call the get_random_items()
function directly on the random_items
attribute or is this considered bad practice in Python?
class Items(object):
def __init__(self, tools, toys, food):
self.tools = tools
self.toys = toys
self.yellow = food
self.random_items = self.get_random_items([self.tools, self.toys, self.food])
def get_random_items(self, item_list)
# do stuff to get random items..
return random_items
If this is bad practice, what would be a better way to provide the random_items
?