3 ms·
> You don't get to play with list comprehensions, unless you're using the type that the language has decided to let you play with. If you decide to use a differ
by leni536 11y ago
> You don't get to play with list comprehensions, unless you're using the type that the language has decided to let you play with. If you decide to use a different type for some reason, you... can't.
You can use generator expressions and pass it to your custom type's constructor.
https://www.python.org/dev/peps/pep-0289/ https://www.python.org/dev/peps/pep-0289/