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