{"id":2203,"date":"2019-07-29T21:33:36","date_gmt":"2019-07-29T19:33:36","guid":{"rendered":"http:\/\/jakisproblem.pl\/?p=2203"},"modified":"2019-07-29T21:34:24","modified_gmt":"2019-07-29T19:34:24","slug":"self-w-pythonie","status":"publish","type":"post","link":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/2019\/07\/29\/self-w-pythonie\/","title":{"rendered":"Self w Pythonie"},"content":{"rendered":"\n<p> Self in python represents or points the instance which it was called.\u00a0 <\/p>\n\n\n\n<p>obj1 = SomeClass()<br>\nobj2 = SomeClass()<br>\nobj1.insert_to_arr(6)<\/p>\n\n\n\n<p> But now how does that method know \u201cwhich object is calling me and whose instance attributes should be updated\u201d. Here, to whose&nbsp;<em>arr<\/em>&nbsp;array should I append the value&nbsp;<em>6<\/em>?&nbsp; <\/p>\n\n\n\n<p>Behind the scene, in every instance method call, python sends the instance also with that method call. So what actually happens is, python convert the above calling of the instance method to something like below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SomeClass.inseart_to_arr(obj1, 6)<br><br>\u0179r\u00f3d\u0142o:  <br><a href=\"https:\/\/medium.com\/quick-code\/understanding-self-in-python-a3704319e5f0\">https:\/\/medium.com\/quick-code\/understanding-self-in-python-a3704319e5f0<\/a> <\/pre>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">Self in python represents or points the instance which it was called.\u00a0 obj1 = SomeClass() obj2 = SomeClass() obj1.insert_to_arr(6) But now how does that method know \u201cwhich object is calling me and whose instance attributes should be updated\u201d. Here, to whose&nbsp;arr&nbsp;array should I append the value&nbsp;6?&nbsp; Behind the scene, in every instance method call, python&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/2019\/07\/29\/self-w-pythonie\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[77],"class_list":["post-2203","post","type-post","status-publish","format-standard","hentry","category-bez-kategorii","tag-python"],"_links":{"self":[{"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/posts\/2203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/comments?post=2203"}],"version-history":[{"count":3,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/posts\/2203\/revisions"}],"predecessor-version":[{"id":2206,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/posts\/2203\/revisions\/2206"}],"wp:attachment":[{"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/media?parent=2203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/categories?post=2203"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/u239160.webh.me\/jakisproblem.pl\/index.php\/wp-json\/wp\/v2\/tags?post=2203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}