我得到一些我无法弄清楚的错误.任何线索我的示例代码有什么问题?
class B:
def meth(self, arg):
print arg
class C(B):
def meth(self, arg):
super(C, self).meth(arg)
print C().meth(1)
Run Code Online (Sandbox Code Playgroud)
我从"超级"内置方法的帮助下得到了示例测试代码."C"级是
这是错误:
Traceback (most recent call last):
File "./test.py", line 10, in ?
print C().meth(1)
File "./test.py", line 8, in meth
super(C, self).meth(arg)
TypeError: super() argument 1 must be type, not classobj
Run Code Online (Sandbox Code Playgroud)
仅供参考,这是来自python本身的帮助(超级):
Help on class super in module __builtin__:
class super(object)
| super(type) -> unbound super object
| super(type, obj) -> bound super object; requires isinstance(obj, type)
| super(type, type2) -> bound …Run Code Online (Sandbox Code Playgroud) 我基本上想在C中使用python等效的py:
int a[x];
Run Code Online (Sandbox Code Playgroud)
但是在python中我声明了一个数组:
a = []
Run Code Online (Sandbox Code Playgroud)
问题是我想为随机插槽分配如下值:
a[4] = 1
Run Code Online (Sandbox Code Playgroud)
但我无法用python做到这一点,因为数组是空的.
I'm trying to build Python 2.7 as a static single .lib file.
I've already made the following changes to the Python source code:
I've managed to compile the pythoncore project to pythoncore.lib (about 11mb size), but when trying to compile the python project I get the following linking errors:
error LNK2019: unresolved external symbol …
有人知道是否可以在Visual Studio 2017 RC中打开旧的(VS2015)Python解决方案和项目?VS 2017无法加载我的项目,只是说它不兼容.我在修改Visual Studio选项中寻找一些Python工具,但在那里找不到任何关于它的东西.
我的 docker 机器有问题。我需要增加超时时间,但我不知道在哪里。我增加了php.ini文件中的超时,但不起作用。
我需要帮助,谢谢!
PD:我的操作系统是 Ubuntu。
python ×4
arrays ×1
compilation ×1
docker ×1
inheritance ×1
object ×1
parent ×1
php ×1
python-2.7 ×1
static ×1
super ×1