I understand it's an inside joke that's meant to stay (just like “f开发者_如何学编程rom __future__ import braces
”), but what exactly does it do?
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 <>
.
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
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
精彩评论