&gt; You don&#x27;t get to play with list comprehensions, unless you&#x27;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&#x27;t.<p>You can use generator expressions and pass it to your custom type&#x27;s constructor.<p><a href="https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0289&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0289&#x2F;</a>