我知道@
前缀会抑制Makefile中shell命令的输出,并且-
前缀将忽略shell命令中的错误.有没有办法将两者结合起来,即一个抑制输出的前缀并忽略错误?我不认为@-
或-@
有效.
我用目录结构创建了自己的Django应用程序
/appname
__init__.py
models.py
/submodule1
__init__.py
a.py
Run Code Online (Sandbox Code Playgroud)
在里面a.py
我有以下导入
from ..models import Something
Run Code Online (Sandbox Code Playgroud)
如果我/appname
在我的/djangoproject
文件夹中,这可以正常工作,但是当我将应用程序安装到Python的站点包(setup.py
我创建了它)时,所有地狱都会破坏并且a.py
无法再导入Something
,并出现以下错误:
ImportError: cannot import name Something
Run Code Online (Sandbox Code Playgroud)
这是setup.py:
from distutils.core import setup
setup(name='appname',
version='0.1',
packages=['appname', 'appname.contrib'],
)
Run Code Online (Sandbox Code Playgroud) 我有一些代码,我想用体内注释来记录,如下所示:
/*! \file best.cpp
* \brief The best
*
* I am the best
*/
/*! \fn void theBestFunction(int)
* I'm the best blah blah blah
*/
void theBestFunction(int ever)
{
doThings();
/*!
* Does some more things
*/
doMoreThings();
/*!
* Checks that the things it does are the best
*/
checkBest();
}
Run Code Online (Sandbox Code Playgroud)
但是当我运行时doxygen
,它似乎将内部块格式化为代码片段,就好像使用了@code
或者\code
命令(它们不是).我希望将体内注释格式化为普通文本.
以前有人遇到过这个吗?谢谢.
我想做这样的事情:
class Dictable:
def dict(self):
raise NotImplementedError
class Foo(Dictable):
def dict(self):
return {'bar1': self.bar1, 'bar2': self.bar2}
Run Code Online (Sandbox Code Playgroud)
是否有更多的pythonic方式来做到这一点?例如,是否可能使内置转换过载dict(...)
?请注意,我不一定要返回所有成员变量Foo
,我宁愿让每个类决定返回什么.
谢谢.