Skip to content

baseitem

roblox.bases.baseitem

This file contains the BaseItem class, which all bases inherit.

BaseItem

This object represents a base Roblox item. All other bases inherit this object. This object overrides equals and not-equals methods ensuring that two bases with the same ID are always equal.

Source code in roblox/bases/baseitem.py
class BaseItem:
    """
    This object represents a base Roblox item. All other bases inherit this object.
    This object overrides equals and not-equals methods ensuring that two bases with the same ID are always equal.
    """
    id = None

    def __repr__(self):
        return f"<{self.__class__.__name__} id={self.id}>"

    def __int__(self):
        return self.id

    def __eq__(self, other):
        return isinstance(other, self.__class__) and other.id == self.id

    def __ne__(self, other):
        if isinstance(other, self.__class__):
            return other.id != self.id
        return True

id

__eq__(self, other) special

Source code in roblox/bases/baseitem.py
def __eq__(self, other):
    return isinstance(other, self.__class__) and other.id == self.id

__int__(self) special

Source code in roblox/bases/baseitem.py
def __int__(self):
    return self.id

__ne__(self, other) special

Source code in roblox/bases/baseitem.py
def __ne__(self, other):
    if isinstance(other, self.__class__):
        return other.id != self.id
    return True

__repr__(self) special

Source code in roblox/bases/baseitem.py
def __repr__(self):
    return f"<{self.__class__.__name__} id={self.id}>"