KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to define a recursive list comprehension in Python? Possibly a simplistic example, but something along the lines of: nums = [1, 1, 2, 2, 3, 3, 4, 4] willThisWork = [x for x in nums if x not in self] # self being the current comprehension Is anything like this possible?
Tags (comma-separated)
Save Edits
Cancel