Forum Discussion
9 years ago
Hmm ok I will give this one more chance. I wrote the code as:
I am not a python expert, and I hate trying to work out other people's uncommented python code because the lack of explicit typing makes it hard to work out what exact bit of data the function is expecting, especially when there are no usage examples in the existing python scripts.
def assign_bassinet_for_baby(sim_info, ignore_daycare=False):
object_manager = services.object_manager()
for bassinet in object_manager.get_objects_of_type_gen(*BabyTuning.BABY_BASSINET_DEFINITION_MAP.values()):
while not bassinet.transient:
set_baby_sim_info_with_switch_id(bassinet, sim_info, ignore_daycare=ignore_daycare)
bassinet.destroy(source=sim_info, cause='Assigned bassinet for baby.')
return True
definition_ids =
for bassinet in object_manager.get_objects_of_def_id_gen(*definition_ids):
while not bassinet.transient:
set_baby_sim_info_with_switch_id(bassinet, sim_info, ignore_daycare=ignore_daycare)
bassinet.destroy(source=sim_info, cause='Assigned bassinet for baby.')
return True
return False
I am not a python expert, and I hate trying to work out other people's uncommented python code because the lack of explicit typing makes it hard to work out what exact bit of data the function is expecting, especially when there are no usage examples in the existing python scripts.