I believe list comprehension is one of Python's most useful features. I think it would be even more useful if Python allowed for recursion within a list comprehension, for something like generating Fibonacci numbers or primes. I know that Python had locals()['_[1]']to reference the list being created, but it was never recommended and was removed.
So, is there a reason Python developers don't want users to use recursion in list comprehension?
source
share