Everything comprehension

One of the most powerful features of Python are comprehensions. They make code shorter and more readable at the same time. We have list comprehensions, dictionary comprehensions, set comprehensions and tuple comprehensions.

I wonder, why not go further, and make Everything Comprehension? I suggest the following syntax:

<any text>

for example

for i in <all prime numbers>:

DataFrame.<delete all rows with negative values>

for f in <all Python files in the current folder>:
    <run unit test on f to check if it works as expected>

if <np == p>: 
    <send email to Fields Medal committee>

As you can see, the code become shorter and more readable at the same time!

You may be reading this and thinking: well, there is a notable technical difficulty in implementing this feature. Yes, indeed, Python already uses < and > for comparison. But in the proposed syntax one can use a <is greater than> b for comparison, and backward compatibility can be ensured by writing <ensure backward compatibility>.


We definitely need the <ensure backward compatibility> feature. This will be very important to future Python proposals. Question: What happens if you do from __future__ import <ensure backward compatibility>? Does this create a timey wimey ball?


Turing prize rather :slight_smile:

# import everything ever written in Python
<import module for module in *>

I have tried the proposed syntax, and it‘s mostly ok, except this always seems to crash:

R = <set of all sets that do not contain themselves>

Any idea what’s going on there?


Hmm, we’ll need to see the traceback. On my system, this line works just fine, although it’s worth noting that R in R is NaN rather than being a boolean.


Funny, all of this was working like a charm on my system last evening. Everyone gathered around the table to watch. Hopes were running high. The future of computing was looking as bright as ever!

Then the clock struck midnight, and all came crashing down.

EverythingComprehensionException: Try again next year!