我有这样的一等:
class MyBase(object):
x = 3
"""Documentation for property x"""
以及继承该遗产的另一类:
class MyObj(MyBase):
x = 0
当我使用瞬间电解生成文件时,没有文件记录MyObj.x
。 是否有办法继承<代码>MyBase.x>上的训示? I found DocInherit,但由于使用矫正器,只能使用分级方法。 这样做是否与财产有关?
我有这样的一等:
class MyBase(object):
x = 3
"""Documentation for property x"""
以及继承该遗产的另一类:
class MyObj(MyBase):
x = 0
当我使用瞬间电解生成文件时,没有文件记录MyObj.x
。 是否有办法继承<代码>MyBase.x>上的训示? I found DocInherit,但由于使用矫正器,只能使用分级方法。 这样做是否与财产有关?
我发现利用财产功能进行工作:
class MyBase(object):
_x = 3
x = property( lambda s: s._x, doc="Documentation for property x")
class MyObj(MyBase):
_x = 0
这是因为:
>>> m = MyObj()
>>> m.x
0
人们可以打电话到<代码>help(m),并获得适当的财产文件<代码>x,间谍网也照此办理。
据我所知,对属性进行扼杀不属于Adhur。 当我尝试时,MyBase.x.__doc__
没有被打到底下。 只处理班级、职能和方法。 如果Sphinx在x = 3
后面插入插座,则可能自行处理源代码。
If you only care for building Documentation via Sphinx. you can use: ":inherited-members:"
.. autoclass:: Noodle
:members:
:inherited-members:
这还将在Sphinx文件中增加继承成员的标记。
rel=“nofollow noreferer”>http://sphinx-doc.org/ext/autodoc.html
正如托马斯已经指出的,属性没有在沙捞越。 但是,Sphinx公司自行处理,允许记录属性。
class Test(object):
#: This is an attibute docstring.
test_attr = test
@property
def test_prop(self):
"""This is a property docstring."""
结果是:
class Test
Bases: object
test_attr = test
This is an attibute docstring.
test_prop
This is a property docstring.
Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...
I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...
Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...
Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...
I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...
Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...
Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...
I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...