{"action":"created","issue":{"url":"https://api.github.com/repos/IIC2233/Syllabus/issues/10","repository_url":"https://api.github.com/repos/IIC2233/Syllabus","labels_url":"https://api.github.com/repos/IIC2233/Syllabus/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/IIC2233/Syllabus/issues/10/comments","events_url":"https://api.github.com/repos/IIC2233/Syllabus/issues/10/events","html_url":"https://github.com/IIC2233/Syllabus/issues/10","id":304219577,"number":10,"title":"Duda con ejemplo Properties","user":{"login":"Panckx","id":37158127,"avatar_url":"https://avatars0.githubusercontent.com/u/37158127?v=4","gravatar_id":"","url":"https://api.github.com/users/Panckx","html_url":"https://github.com/Panckx","followers_url":"https://api.github.com/users/Panckx/followers","following_url":"https://api.github.com/users/Panckx/following{/other_user}","gists_url":"https://api.github.com/users/Panckx/gists{/gist_id}","starred_url":"https://api.github.com/users/Panckx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Panckx/subscriptions","organizations_url":"https://api.github.com/users/Panckx/orgs","repos_url":"https://api.github.com/users/Panckx/repos","events_url":"https://api.github.com/users/Panckx/events{/privacy}","received_events_url":"https://api.github.com/users/Panckx/received_events","type":"User","site_admin":false},"labels":[{"id":860530167,"url":"https://api.github.com/repos/IIC2233/Syllabus/labels/Material","name":"Material","color":"0e8a16","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-12T02:05:30Z","updated_at":"2018-04-02T22:16:11Z","closed_at":"2018-03-12T03:07:33Z","author_association":"NONE","body":"Hola! Estaba viendo los contenidos de Properties y en la celda en que se define la clase Puente con decoradores algo no está funcionando bien, porque luego de que se setea la cantidad de personas en el puente a 10, se le restan 15 personas y quedan 5 personas, lo que no hace mucho sentido. De hecho está ocurriendo algo totalmente distinto, como se puede apreciar en el mismo código algo modificado:\r\n\r\n```python\r\n\"\"\"\r\nImplementación de un puente.\r\n\"\"\"\r\n\r\n\r\nclass Puente:  # pylint: disable=too-few-public-methods\r\n\r\n    \"\"\"Esta clase modela el funcionamiento de un puente.\"\"\"\r\n\r\n    def __init__(self, maximo):\r\n        self.maximo = maximo\r\n        self.__personas = 0\r\n\r\n    @property\r\n    def personas(self):\r\n        \"\"\"Retorna la cantidad de personas en el puente.\"\"\"\r\n        return self.__personas\r\n\r\n    @personas.setter\r\n    def personas(self, suma):\r\n        print('Sumando {}'.format(suma))\r\n        if self.__personas + suma > self.maximo:\r\n            print('Se le suma {}, pero se pasa del máximo'.format(suma))\r\n            self.__personas = self.maximo\r\n        elif self.__personas + suma < 0:\r\n            print('Se le suma {}, pero se pasa del mínimo'.format(suma))\r\n            self.__personas = 0\r\n        else:\r\n            print('Se le suma {}, está dentro del rango'.format(suma))\r\n            self.__personas += suma\r\n        print()\r\n\r\n\r\nPUENTE = Puente(10)\r\nprint('Sumar 7:')\r\nPUENTE.personas += 7\r\nprint('Sumar 5:')\r\nPUENTE.personas += 5\r\nprint('Sumar -15:')\r\nPUENTE.personas -= 15\r\n```\r\n\r\nMi pregunta entonces es, cómo se pueden usar los decoradores en el mismo ejemplo para poder usar la suma como parte de la propiedad?"},"comment":{"url":"https://api.github.com/repos/IIC2233/Syllabus/issues/comments/378063650","html_url":"https://github.com/IIC2233/Syllabus/issues/10#issuecomment-378063650","issue_url":"https://api.github.com/repos/IIC2233/Syllabus/issues/10","id":378063650,"user":{"login":"julioag","id":26441194,"avatar_url":"https://avatars0.githubusercontent.com/u/26441194?v=4","gravatar_id":"","url":"https://api.github.com/users/julioag","html_url":"https://github.com/julioag","followers_url":"https://api.github.com/users/julioag/followers","following_url":"https://api.github.com/users/julioag/following{/other_user}","gists_url":"https://api.github.com/users/julioag/gists{/gist_id}","starred_url":"https://api.github.com/users/julioag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julioag/subscriptions","organizations_url":"https://api.github.com/users/julioag/orgs","repos_url":"https://api.github.com/users/julioag/repos","events_url":"https://api.github.com/users/julioag/events{/privacy}","received_events_url":"https://api.github.com/users/julioag/received_events","type":"User","site_admin":false},"created_at":"2018-04-02T22:16:11Z","updated_at":"2018-04-02T22:16:11Z","author_association":"NONE","body":"Hola , estuve leyendo la explicación pero no me quedó claro la forma en que debiese alterar los atributos y que las properties se respeten??\r\ngracias"}}
{"actor":{"display_login":"julioag"}}