本文整理匯總了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 )