Apr-09-2020, 07:42 AM
I refactored the code a litte bit.
Test it if it works as expected. Look at the differences.
Have no time to check it for myself.
Test it if it works as expected. Look at the differences.
Have no time to check it for myself.
my_dict = {} default_sizes = [300, 100] def create(text="Default Text", x=None, y=None): local_dict = {} if x is None: local_dict["x_position"] = default_sizes[0] else: local_dict["x_position"] = x if y is None: local_dict["y_position"] = default_sizes[1] + len(my_dict) else: local_dict["y_position"] = y return local_dict for idx in range(10): my_dict[idx] = create() print(my_dict)
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!