本文整理汇总了Python中PyUtils.sameObjectInList方法的典型用法代码示例。如果您正苦于以下问题:Python PyUtils.sameObjectInList方法的具体用法?Python PyUtils.sameObjectInList怎么用?Python PyUtils.sameObjectInList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyUtils
的用法示例。
在下文中一共展示了PyUtils.sameObjectInList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add
# 需要导入模块: import PyUtils [as 别名]
# 或者: from PyUtils import sameObjectInList [as 别名]
def add(self, object):
"""Adds an object to the list, notify observers."""
if PyUtils.sameObjectInList(object, self._objects) :
raise KeyError ('Cannot add the same object twice to application.')
self._objects.append( object )
self.notifyObservers()
return object
示例2: addCharacter
# 需要导入模块: import PyUtils [as 别名]
# 或者: from PyUtils import sameObjectInList [as 别名]
def addCharacter(self, character):
"""Adds a character to the application and the world"""
import Physics
if PyUtils.sameObjectInList(character, self._characters) :
raise KeyError ('Cannot add the same character twice to application.')
Physics.world().addArticulatedFigure( character )
self._characters.append( character )
if self._followedCharacter is None :
self._followedCharacter = character
self._cameraFollowCharacter = True
self._cameraObservable.notifyObservers()
self._characterObservable.notifyObservers()