在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?

请每个回答只回答一个特征。


当前回答

Python 2. x

>>>True = False
>>>True
False

你真的可以让一个人变得疯狂。

其他回答

对我来说,它绝对是INTERCAL中的PLEASE修饰符。 如果PLEASE出现的次数不够多,则认为程序不够礼貌,错误消息如下所示;如果太频繁,这个程序可能会被认为过于礼貌而被拒绝。

我最讨厌的特性是任何包含条件逻辑的配置文件语法。这类事情在Java世界(Ant、Maven等)中非常普遍。你知道你是谁!)

你最终只能用c**p语言编程,调试和编辑器支持有限。

如果在配置中需要逻辑,那么用真正的语言编码配置的“Pythonic”方法会好得多。

我一直想知道这个函数在Java Core库的Math类中的用途:

static double expm1(double x);  // Returns e^x - 1.

INTERCAL可能是最奇怪的语言特征的最佳汇编。我个人最喜欢的是COMEFROM语句,它(几乎)与GOTO相反。

COMEFROM is roughly the opposite of GOTO in that it can take the execution state from any arbitrary point in code to a COMEFROM statement. The point in code where the state transfer happens is usually given as a parameter to COMEFROM. Whether the transfer happens before or after the instruction at the specified transfer point depends on the language used. Depending on the language used, multiple COMEFROMs referencing the same departure point may be invalid, be non-deterministic, be executed in some sort of defined priority, or even induce parallel or otherwise concurrent execution as seen in Threaded Intercal. A simple example of a "COMEFROM x" statement is a label x (which does not need to be physically located anywhere near its corresponding COMEFROM) that acts as a "trap door". When code execution reaches the label, control gets passed to the statement following the COMEFROM. The effect of this is primarily to make debugging (and understanding the control flow of the program) extremely difficult, since there is no indication near the label that control will mysteriously jump to another point of the program.

JCL条件返回执行。

//STEP02 EXEC PGM=PROG02,COND=(4,GT,STEP01) .

该特性允许您根据前面步骤的返回代码运行或不运行某个步骤。真是个不错的功能。

除了一些小功能,把逻辑颠倒过来。

首先,如果条件为真,则不运行步骤。

其次,4 GT,STEP01实际上意味着“如果STEP01的返回码大于4”

因此,整个过程意味着“如果来自STEP01的返回代码大于4,则不要运行此步骤”。这与“如果4大于来自STEP01的返回代码,则运行步骤”的简单解释几乎相同,但并不完全相同。

考虑到你唯一认真看待这些事情的时间是凌晨2点30分左右,电话另一端是一个疯狂的夜班接线员,这种双重模糊会导致严重的头痛。