Skip to content

Fix mutable default arguments and replace assertions with proper exceptions#181

Merged
ClemensSchwarke merged 1 commit intoleggedrobotics:mainfrom
jashshah999:fix/mutable-defaults-and-assertions
Feb 26, 2026
Merged

Fix mutable default arguments and replace assertions with proper exceptions#181
ClemensSchwarke merged 1 commit intoleggedrobotics:mainfrom
jashshah999:fix/mutable-defaults-and-assertions

Conversation

@jashshah999
Copy link
Copy Markdown
Contributor

Summary

  • Replaced mutable list defaults [256, 256, 256] with tuples (256, 256, 256) in MLPModel, CNNModel, and RNNModel constructors to prevent potential shared state across instances.
  • Replaced assert statements used for input validation with raise ValueError(...) in MLPModel._get_obs_dim, CNNModel._get_obs_dim, CNNModel.__init__, and resolve_rnd_config, since assertions are silently stripped when running with python -O (optimized mode).

…ptions

- Replace mutable list default `[256, 256, 256]` with tuple `(256, 256, 256)` in MLPModel, CNNModel, and RNNModel to prevent potential shared state across instances.
- Replace `assert` statements used for input validation with `raise ValueError(...)` in MLPModel, CNNModel, and RND, since assertions are silently stripped when running with `python -O`.
@ClemensSchwarke ClemensSchwarke merged commit a1f3c1d into leggedrobotics:main Feb 26, 2026
@ClemensSchwarke
Copy link
Copy Markdown
Collaborator

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants