在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
当前回答
在ruby/python/c中,你可以像这样连接字符串:
a = "foo" "bar"
print a # => "foobar"
其他回答
英语中的虚拟语气。
等等,你是说编程语言吗?然后在C中使用(宏)绕过宏()的预处理器#定义。例如,如果有人使用#define free(…),(free)(…)将与free(…)不同。
Python for循环中的else。
来自Python文档:
for n in range(2, 10):
for x in range(2, n):
if n % x == 0:
print n, 'equals', x, '*', n/x
break
else:
# loop fell through without finding a factor
print n, 'is a prime number'
输出:
2 is a prime number
3 is a prime number
4 equals 2 * 2
5 is a prime number
6 equals 2 * 3
7 is a prime number
8 equals 2 * 4
9 equals 3 * 3
通知7。一个有效程序的例子:
Chomsky is a room. A thought is a kind of thing. Color is a kind of value. The colors are red, green and blue. A thought has a color. It is usually Green. A thought can be colorful or colorless. It is usually colorless. An idea is a thought in Chomsky with description "Colorless green ideas sleep furiously." A manner is a kind of thing. Furiously is a manner. Sleeping relates one thought to one manner. The verb to sleep (he sleeps, they sleep, he slept, it is slept, he is sleeping) implies the sleeping relation. Colorless green ideas sleep furiously.
像图灵机模拟器这样的其他愚蠢的东西可以找到。
Java源文件可以以字符\u001a (control-Z)结尾。
Delphi不关心像“word”这样的类型转换,将读取数组arr[0..65535] where pos = 65535: Arr[单词(pos + 10)]