fossilfree / numerous

Numerous - an object-oriented modelling and simulation engine.
https://numerous.com
BSD 3-Clause "New" or "Revised" License
14 stars 9 forks source link

Simulation constructor start_datetime default argument potentially causes bugs #156

Open jfeodor opened 2 years ago

jfeodor commented 2 years ago

https://github.com/fossilfree/numerous/blob/121cd00456f263cab9def10cb99a21655f5832c9/numerous/engine/simulation/simulation.py#L31

I randomly stumbled upon this line in the the Simulation class constructor. The start_datetime argument has the default argument datetime.now(), which is evaluated when the class is defined, and not when it is instantiated. Alternatively the default argument could be None, and then redefined to datetime.now() inside the function body.