Skip to content

Avoid using loop variable outside the loop #377

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

Merged
merged 1 commit into from
Apr 7, 2025

Conversation

DimitriPapadopoulos
Copy link
Contributor

Although that's not the case here, the variable will be undefined if the list is empty.

Although that's not the case here, the variable will be undefined if
the list is empty.
@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review April 6, 2025 11:27
@FrancescAlted FrancescAlted merged commit 8df9191 into Blosc:main Apr 7, 2025
7 checks passed
@FrancescAlted
Copy link
Member

LGTM. Thanks @DimitriPapadopoulos !

@FrancescAlted
Copy link
Member

FrancescAlted commented Apr 7, 2025

For some reason, this made CI to crash. It is strange that it passes the tests in the PR though... I just removed this one from main.

@DimitriPapadopoulos DimitriPapadopoulos deleted the PYL-W0631 branch April 7, 2025 20:03
@DimitriPapadopoulos
Copy link
Contributor Author

I fixed the issue manually. Somehow, at the moment I was writing this, I thought len() can iterate to get the length. Of course, that's wrong:

>>> z = zip([1, 2, 3], [11, 22, 33])
>>> 
>>> len(z)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: object of type 'zip' has no len()
>>> 
>>> len(list(z))
3
>>> 

Sorry about that.

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