How to use a lambda expression in a decorator?

Viewed 66

I found this piece of interesting code online, however it throws a syntax error. How can I fix it?

@lambda _: _()
class _:
    def __format__(_, __):
        _.__class__._ = property(lambda _: print(__))
        return ""
def __() -> f"{_: Hello, world!}": ...
_._

Error:

  File "<ipython-input-17-773eeacca942>", line 1
    @lambda _: _()
          ^
SyntaxError: invalid syntax
0 Answers
Related