[Python] Maximum recursion depth on class

Discussão em 'Python' iniciado por Stack, Maio 19, 2025.

  1. Stack

    Stack Membro Participativo

    I have a class that I'm trying to set is_duplicate to True like:

    file = FileProperties(long, lat, timestamp, compas, filename)
    [...]
    file.is_duplicate = True


    And I get a RuntimeError: maximum recursion depth exceeded while calling a Python object what exactly am I doing wrong? The file class creation is also happening in a for loop, but I don't think that's the issue with this specific error.

    class FileProperties(object):
    def __init__(self, longitude, latitude, timestamp, compas, filename):
    self._longitude = longitude
    self._latitude = latitude
    self._timestamp = timestamp
    self._filename = filename
    self._compas = compas
    self._duplicate = False
    self._teleporting = False

    @property
    def get_lat(self):
    return self._latitude

    @property
    def get_long(self):
    return self._longitude

    @property
    def get_timestamp(self):
    return self._timestamp

    @property
    def get_filename(self):
    return self._filename

    @property
    def get_compas(self):
    return self._compas

    @property
    def is_duplicate(self):
    return self._duplicate

    @property
    def is_teleporting(self):
    return self._teleporting

    @is_duplicate.setter
    def is_duplicate(self, value):
    self.is_duplicate = value

    @is_teleporting.setter
    def is_teleporting(self, value):
    self._teleporting = value

    Continue reading...

Compartilhe esta Página