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

Support passing a generator #36

Open
pbauer opened this issue Oct 9, 2020 · 0 comments
Open

Support passing a generator #36

pbauer opened this issue Oct 9, 2020 · 0 comments

Comments

@pbauer
Copy link
Member

pbauer commented Oct 9, 2020

Currently you cant create a ContentListing from a generator. Since in python3 many thing that previously were lists are now generators it would be usefull to allow passing a generator.
Obviously we cannot keep the generator but turn it into a sequence in __init__.py.

How about this?

    def __init__(self, sequence):
        if isinstance(sequence, GeneratorType):
            sequence = [i for i in sequence]
        self._basesequence = sequence
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

No branches or pull requests

1 participant