Skip to content

refactor: Made _T_DIST_95_CONF_LEVELS a tuple because it's a constant… - #254

Merged
vstinner merged 1 commit into
psf:mainfrom
DebanKsahu:impr/improvement
Aug 31, 2026
Merged

refactor: Made _T_DIST_95_CONF_LEVELS a tuple because it's a constant…#254
vstinner merged 1 commit into
psf:mainfrom
DebanKsahu:impr/improvement

Conversation

@DebanKsahu

Copy link
Copy Markdown
Contributor

Description

  • I was reading the code and saw that _T_DIST_95_CONF_LEVELS never modified in the later part of _utils.py file as it is only accessed so I thought it is reasonable to make it a tuple instead of the dynamic list.
  • This has no significant performance gain, but I think it would avoid the amortized space allocation for dynamic list in python which happens to avoid amortized O(N) complexity for append operation

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really a pedantic change... It's a private constant in a private module, the constant is only used by tdist95conf_level().

This has no significant performance gain, but I think it would avoid the amortized space allocation for dynamic list in python which happens to avoid amortized O(N) complexity for append operation

_T_DIST_95_CONF_LEVELS is never modified, so this point is irrelevant.

I only approved the change to avoid someone else proposing a similar change in the future.

@vstinner
vstinner merged commit 5a6b560 into psf:main Aug 31, 2026
14 checks passed
@DebanKsahu

Copy link
Copy Markdown
Contributor Author

Sorry, I will be careful with the future code changes if I made any.

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