Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Parameter values shared across Python class instances

Open
#313 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp, python
Domain
tooling

Research direction

Start by locating the Python code generator and its tests for generated parameter classes; the issue does not name specific files. Check how the generated Param class declares parameter values and how instances are tested. Done means each new instance starts with independent parameter values, with a test covering that behavior.

Written by the indexing model from the issue text.

Description

I’m trying to create tests to verify the interaction of my software with the generate_parameter_library. I want to save the parameters to a file when they are updated in both Python and C++. The testes for the C++ version worked correctly, but in Python, I noticed an odd behaviour. The parameter values are shared across multiple instances. This resulted in the tests failing due to an inconsistent initial value. I expected a reset to parameter values when a new instance is created.

Looking at the generated code, I noticed the Param class doesn’t have an __init__(self) function and declares the parameters directly in the class body. This causes the parameters to be shared between instances. Is this the desired behaviour?

Adding the __init__(self) function and selfto the variables solved this. As a quick fix, I reloaded the entire module between each test.

If this is not intended, I can provide a pull request to solve this issue.

Auto generated code:
Image

Expected generated code:

Image
Dominant language
Python
Stars
385
Forks
81
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PickNikRobotics/generate_parameter_library

All issues in PickNikRobotics/generate_parameter_library

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.