GO语言有预处理器吗?当我查找互联网时,很少有*.pgo转换为*.go的方法.而且,我想知道Go是否可行
#ifdef COMPILE_OPTION
{compile this code ... }
#elif
{compile another code ...}
Run Code Online (Sandbox Code Playgroud)
要么,
#undef in c
使用Python 3.4,我SyntaxError: invalid syntax来到这里:
>>> xlist = [1,2,3,4,5]
>>> [yield(x) for x in xlist]
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
但是这会生成一个生成器对象:
>>> [(yield(x)) for x in xlist]
<generator object <listcomp> at 0x00000076CC8E5DB0>
Run Code Online (Sandbox Code Playgroud)
是否需要围绕产量的圆括号?
我搜索了stackoverflow中的其他帖子,甚至复制了它们以尝试在我的机器上尝试回答。但是,它始终无法抛出"TypeError"
# this is as one of other post in StackOverflow.
class ListClass(list):
def __init__(self, *args):
super().__init__(self, *args)
self.append('a')
self.name = 'test'
Run Code Online (Sandbox Code Playgroud)
我还尝试了通过的空课。但是,如果我继承并且我想念了一些东西而不是添加更多或错误的东西,那也失败了?
1)这是什么"TypeError",为什么?2)如何解决?
有关TypeError的更多快照:
>>> class ListClass(list):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: list() takes at most 1 argument (3 given)
Run Code Online (Sandbox Code Playgroud)