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

Fix zip usage for compatibility with python 3 #25

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

Conversation

mxmpl
Copy link

@mxmpl mxmpl commented Nov 15, 2022

In Python 3, zip returns an iterator and not a list as in Python 2: it exhausts once it has been iterated over.

This behaviour causes issues in

for spkr in self.speakers:
spk_utts = [utt_id for utt_id, utt_speaker in self.utts
if utt_speaker == spkr]

as self.utts is defined in
self.utts = zip(utt_ids, utt_speakers)

For the first spkr, spk_utts is correct, but for the next ones it is an empty list as self.utts is exhausted.

This PR fixes this by changing zip(...) to list(zip(...)).

@mxmpl mxmpl self-assigned this Nov 15, 2022
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.

1 participant