Skip to content

Pythonic replacement for the mutable default for vertices argument of Volume class constructor#3159

Merged
stevengj merged 1 commit intoNanoComp:masterfrom
oskooi:mutable_default_bug_fix
Mar 2, 2026
Merged

Pythonic replacement for the mutable default for vertices argument of Volume class constructor#3159
stevengj merged 1 commit intoNanoComp:masterfrom
oskooi:mutable_default_bug_fix

Conversation

@oskooi
Copy link
Copy Markdown
Collaborator

@oskooi oskooi commented Mar 1, 2026

The vertices argument of the Volume class constructor uses a mutable default (a list). While this is not a functional bug since the list object is never mutated as vertices is a throwaway parameter used only to compute center and size, it is a code smell as it would fail a linter like pylint or ruff with B006/W0102. This PR replaces the mutable default with an idiomatic Python convention – None as a sentinel for "no value provided" is universally understood.

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.90%. Comparing base (f29a8c7) to head (3facd51).
⚠️ Report is 108 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3159      +/-   ##
==========================================
+ Coverage   73.81%   73.90%   +0.09%     
==========================================
  Files          18       18              
  Lines        5423     5454      +31     
==========================================
+ Hits         4003     4031      +28     
- Misses       1420     1423       +3     
Files with missing lines Coverage Δ
python/simulation.py 77.56% <100.00%> (+0.15%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stevengj stevengj changed the title Pythonic replacement for the mutable default for vertices argument of Voume class constructor Pythonic replacement for the mutable default for vertices argument of Volume class constructor Mar 2, 2026
@stevengj stevengj merged commit 72a530b into NanoComp:master Mar 2, 2026
5 checks passed
@oskooi oskooi deleted the mutable_default_bug_fix branch March 2, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants