在一些代码中,我发现了这样的语句:
p = property
我的问题是这个声明的意思是什么?
(我发布的代码是一个更大的包(http://asymptote.sourceforge.net/)的摘录,p = propery
背后的总体思想是什么?)你知道吗
一些背景,完整的文件与此声明:
#!/usr/bin/env python3
import gettext
p = property
class xasyString:
def __init__(self, lang=None):
s = self
if lang is None:
_ = lambda x: x
else:
lng = gettext.translation('base', localedir='GUI/locale', languages=[lang])
lng.install()
_ = lng.gettext
s.rotate = _('Rotate')
s.scale = _('Scale')
s.translate = _('Translate')
s.fileOpenFailed = _('File Opening Failed.')
s.fileOpenFailedText = _('File could not be opened.')
s.asyfyComplete = _('Ready.')
我能找到的关于p
的唯一进一步参考是:
class asyLabel(asyObj):
"""A python wrapper for an asy label"""
...
def updateCode(self, asy2psmap=identity()):
"""Generate the code describing the label"""
newLoc = asy2psmap.inverted() * self.location
locStr = xu.tuple2StrWOspaces(newLoc)
self.asyCode = 'Label("{0}",{1},p={2}{4},align={3})'.format(self.text, locStr, self.pen.getCode(), self.align,
self.getFontSizeText())
p = property
只是使p
成为另一个对property
类型的引用,以便以后可以写入而不是
property
是一个类型,因此p
只是同一类型的另一个名称。你知道吗相关问题 更多 >
编程相关推荐