cosmologicon / pywat

Python wats

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add wat: print not equal to lambda x: print(x)

zzh1996 opened this issue · comments

>>> class A:
...  pass
... 
>>> a = A()
>>> A.f = print
>>> a.f()

>>> A.f = lambda x: print(x)
>>> a.f()
<__main__.A object at 0x1023739b0>

Oh yes?

Try A.f() instead of a.f() - I don't think it's really a WAT.

And when writing A.f = print differently, you should write A.f = lambda *args, **kwargs: print(*args, **kwargs) anyway.