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

Use sys.maxsize instead of sys.maxint #516

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jsxs0
Copy link
Contributor

@jsxs0 jsxs0 commented Feb 23, 2023

In Python 3, the sys.maxint constant was removed as the integer type in Python 3 can represent arbitrarily large integers, making sys.maxint redundant. Instead, it is recommended to use sys.maxsize, which is an integer value that is larger than any practical list or string index.

@tfmoraes
Copy link
Member

Hi @jsxs0 sys.maxsize is already being used inside the try, maybe we need to use other value inside the exception or verify if exception can happen.

@jsxs0
Copy link
Contributor Author

jsxs0 commented Feb 23, 2023

Thanks for your response, @tfmoraes! Ah yes, sys.maxsize is already used inside the try.
Would using a different value in the except block make sense? For example, we could use a smaller value than sys.maxint, such as sys.maxsize // 2 to ensure the item is inserted with a valid index even if the maximum integer value is exceeded.

@tfmoraes
Copy link
Member

I look for examples in the wxpython discuss and demo and I didn't find an example with the try ... except I think we can remove this try...except. Also, this GUI is not used in InVesalius.

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.

None yet

2 participants