{"action":"closed","issue":{"url":"https://api.github.com/repos/IIC2233/Syllabus/issues/75","repository_url":"https://api.github.com/repos/IIC2233/Syllabus","labels_url":"https://api.github.com/repos/IIC2233/Syllabus/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/IIC2233/Syllabus/issues/75/comments","events_url":"https://api.github.com/repos/IIC2233/Syllabus/issues/75/events","html_url":"https://github.com/IIC2233/Syllabus/issues/75","id":214595880,"number":75,"title":"Duda variables de clase","user":{"login":"BenjaPrograma","id":26238496,"avatar_url":"https://avatars1.githubusercontent.com/u/26238496?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjaPrograma","html_url":"https://github.com/BenjaPrograma","followers_url":"https://api.github.com/users/BenjaPrograma/followers","following_url":"https://api.github.com/users/BenjaPrograma/following{/other_user}","gists_url":"https://api.github.com/users/BenjaPrograma/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjaPrograma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjaPrograma/subscriptions","organizations_url":"https://api.github.com/users/BenjaPrograma/orgs","repos_url":"https://api.github.com/users/BenjaPrograma/repos","events_url":"https://api.github.com/users/BenjaPrograma/events{/privacy}","received_events_url":"https://api.github.com/users/BenjaPrograma/received_events","type":"User","site_admin":false},"labels":[{"id":553796006,"url":"https://api.github.com/repos/IIC2233/Syllabus/labels/Control","name":"Control","color":"0e8a16","default":false},{"id":553796218,"url":"https://api.github.com/repos/IIC2233/Syllabus/labels/Python","name":"Python","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-03-16T04:28:09Z","updated_at":"2017-03-19T22:50:31Z","closed_at":"2017-03-19T22:50:31Z","body":"Tengo una duda con la respuesta que aparece en la pauta de un control de semestre anterior.\r\n\r\n**1) (3 pts.) Explique brevemente la diferencia entre los atributos `a` y `b` de la clase mostrada a continuación**\r\n```python\r\nclass Foo:\r\n    a = 0\r\n    def __init__(self, value):\r\n\tself.b = value\r\n\tFoo.a += 1\r\n\r\ni1 = Foo(5)\r\ni2 = Foo(3)\r\n\r\nprint(i1.b)\r\nprint(i2.b)\r\nprint(i2.a)\r\n```\r\n\r\n\r\nEl atributo `a` es un atributo perteneciente a la clase mientras que el atributo `b` es de la instancia. **(1.5 pts)**. Un atributo perteneciente a la clase comparte su valor con todas las instancias de la clase, **si alguna lo modifica su valor, se cambia en todas las instancias también**. El valor de un atributo de la instancia puede variar según la instancia y es propio de ésta. **(1.5 pts)**\r\n\r\nSegun lo que tengo entendido, si una instancia cambia el valor de la variable de la clase, se cambia SOLO para esta instancia, por ej i2.a = 5, alteraria el valor solo para i2, pero si hago print(Foo.a) esta no tiene el valor cambiado, entonces no entiendo porque dice que si alguna instancia cambia su valor, se cambia para todas.\r\n\r\nSaludos,\r\nBenjamín\r\n\r\nEDIT: Edite tu issue para que el código se viera mucho mejor y mas entendible. Atte Hernan4444"}}
{"actor":{"display_login":"jtagle2"}}