本文整理汇总了Python中PyUtils.getterName方法的典型用法代码示例。如果您正苦于以下问题:Python PyUtils.getterName方法的具体用法?Python PyUtils.getterName怎么用?Python PyUtils.getterName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyUtils
的用法示例。
在下文中一共展示了PyUtils.getterName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _addIndirectVar
# 需要导入模块: import PyUtils [as 别名]
# 或者: from PyUtils import getterName [as 别名]
def _addIndirectVar(self, varName, initialValue):
"""Add an indirect variable with the given name, as well as its getter and setter."""
if isinstance(initialValue, _Symmetric) :
self.__setattr__( PyUtils.getterName(varName), lambda side: self.getIndirectVarSymmetric(varName, side) )
else:
self.__setattr__( PyUtils.getterName(varName), lambda: self.getIndirectVar(varName) )
self._indirectVarsAreValid = None
self.__setattr__(varName, initialValue)
示例2: _addNativeVar
# 需要导入模块: import PyUtils [as 别名]
# 或者: from PyUtils import getterName [as 别名]
def _addNativeVar(self, varName, initialValue):
"""Add a variable with he given name, as well as its getter and setter."""
if isinstance(initialValue, _Symmetric) :
self.__setattr__( PyUtils.getterName(varName), lambda side: self.getNativeVarSymmetric(varName, side) )
self.__setattr__( PyUtils.setterName(varName), lambda side, value: self.setNativeVarSymmetric(varName, side, value) )
else :
self.__setattr__( PyUtils.getterName(varName), lambda: self.getNativeVar(varName) )
self.__setattr__( PyUtils.setterName(varName), lambda value: self.setNativeVar(varName, value) )
self.__setattr__( varName, initialValue )