那么“ from__ future__ import barry_as_FLUFL”到底是做什么的呢?

我知道这是一个内部笑话,意味着留(就像“ from __future__ import braces”) ,但它到底做什么?

21013 次浏览

It's related to PEP 0401: BDFL Retirement

Barry refers to Barry Warsaw, a well-known Python developer. The from __future__ import barry_as_FLUFL basically replaces the != operator with <>.

The April Fool's joke PEP 0401 is really funny and so its current implementation. It works very good interactively from the terminal or by python3 -i from the standart input, but surprisingly not from a normal script or without -i. It works by eval(...) or by compile(..) this way:

exec(compile('1<>0', 'foo', 'single', __future__.CO_FUTURE_BARRY_AS_BDFL))
True

As mentioned above, barry is Barry Warsaw, a well known Core Python Dev However, the FLUFL has not been explained

It stands for "Friendly Language Uncle For Life" an inside joke among the other python core devs at the time. The reason this enables the <> syntax, is that he was the primary person who wanted to use the <> operator