So what exactly does “from __future__ import barry_as_FLUFL” do?

前端 未结 3 1243
[愿得一人]
[愿得一人] 2020-12-08 08:48

I understand it\'s an inside joke that\'s meant to stay (just like “from __future__ import braces”), but what exactly does it do?

相关标签:
3条回答
  • 2020-12-08 09:32

    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                                                                     more funny than horrible != that caused finger pain

    0 讨论(0)
  • 2020-12-08 09:40

    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

    0 讨论(0)
  • 2020-12-08 09:47

    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 <>.

    0 讨论(0)
提交回复
热议问题