Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding super().__init__() to MoneyModel tutorial #2025

Merged
merged 2 commits into from
Feb 4, 2024
Merged

Conversation

sw23
Copy link
Contributor

@sw23 sw23 commented Feb 4, 2024

Noticed this error in my project, so turned to the tutorial for reference, which had the same error!

AttributeError: 'MoneyModel' object has no attribute '_steps'

I poked around and found that model sub-classes now require a call to super().__init__(), which wasn't originally in the tutorial. I also saw someone opened an issue ( #2017 ) to fix the tutorial, so opening this if it's helpful.

Copy link

github-actions bot commented Feb 4, 2024

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
Schelling small 🔵 -1.0% [-1.3%, -0.8%] 🔵 -0.1% [-0.3%, +0.1%]
Schelling large 🔵 +2.1% [+0.9%, +3.2%] 🔵 +0.8% [+0.0%, +1.7%]
WolfSheep small 🔵 +0.1% [-0.2%, +0.3%] 🔵 +0.2% [+0.1%, +0.3%]
WolfSheep large 🔵 -0.7% [-1.4%, -0.3%] 🔵 +0.0% [-0.3%, +0.3%]
BoidFlockers small 🔴 +5.4% [+4.7%, +6.1%] 🔵 -1.1% [-1.8%, -0.3%]
BoidFlockers large 🔴 +5.3% [+4.8%, +5.8%] 🔵 -1.0% [-1.4%, -0.5%]

@Corvince
Copy link
Contributor

Corvince commented Feb 4, 2024

Thank you for bringing this up! This is quite important, because using super().init() should be encouraged (and thus in the tutorial), but not strictly required before mesa 3.0. So it is actually a bug you found.

@rht rht merged commit 7cadddb into projectmesa:main Feb 4, 2024
13 checks passed
@EwoutH EwoutH added the docs Release notes label label Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Release notes label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants