Skip to content

Automatic time and step incrementing #2222

@EwoutH

Description

@EwoutH

This issue is a spin-off of the discussion in #1942 (comment)

Background

Currently, Mesa models require users to explicitly increase the time and step counters using _advance_time(). This approach can be unintuitive and prone to errors, especially for new users. It's also weird to have to use a private method to advance the time.

Motivation

We want to simplify the model creation process and reduce the potential for errors by automatically incrementing time and step counters. This change would make Mesa more user-friendly.

Simultaneously, the time-increase should be able to be overwritten if needed.

API proposal

I would propose the following user interface:

class Model:
    ...
    def step(self, time=1, step=1):
        ...

The default is time=1 and step=1. Users can change these numbers if they want, but they don't need to. If you want to turn both off, you can just say step(self, time=False, step=False), because in Python, the False is interpreted as 0.

Then we need to have one giant final battle if the time and step increases at the beginning of the step or the end of the step.

Curious what everybody thinks. If anyone has the golden bullet on an implementation idea, please share!

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingRelease notes label

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions