{"action":"created","issue":{"url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/244","repository_url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation","labels_url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/244/labels{/name}","comments_url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/244/comments","events_url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/244/events","html_url":"https://github.com/swcarpentry/python-novice-inflammation/pull/244","id":138960818,"number":244,"title":"Prefer functions over methods.","user":{"login":"tbekolay","id":203709,"avatar_url":"https://avatars.githubusercontent.com/u/203709?v=3","gravatar_id":"","url":"https://api.github.com/users/tbekolay","html_url":"https://github.com/tbekolay","followers_url":"https://api.github.com/users/tbekolay/followers","following_url":"https://api.github.com/users/tbekolay/following{/other_user}","gists_url":"https://api.github.com/users/tbekolay/gists{/gist_id}","starred_url":"https://api.github.com/users/tbekolay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbekolay/subscriptions","organizations_url":"https://api.github.com/users/tbekolay/orgs","repos_url":"https://api.github.com/users/tbekolay/repos","events_url":"https://api.github.com/users/tbekolay/events{/privacy}","received_events_url":"https://api.github.com/users/tbekolay/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/labels/enhancement","name":"enhancement","color":"E0115F"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2016-03-07T11:53:40Z","updated_at":"2016-03-14T18:07:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/pulls/244","html_url":"https://github.com/swcarpentry/python-novice-inflammation/pull/244","diff_url":"https://github.com/swcarpentry/python-novice-inflammation/pull/244.diff","patch_url":"https://github.com/swcarpentry/python-novice-inflammation/pull/244.patch"},"body":"Most methods on NumPy arrays also have an equivalent NumPy function that takes the array as input. I have noticed that many novice programmers prefer functions (which have a pretty clear input-output relationship) to methods (which have an implicit input). This PR changes all instances of calling methods on arrays to calling the equivalent NumPy function instead. I tried to simplify the explanation in `01-numpy.md` as well, which hopefully does not significantly affect the flow of the prose.\r\n\r\nThis PR came out of one of the discussion sessions (apologies, I don't remember who brought this up -- if it was you, let me know and I'll add you to the commit message :) )"},"comment":{"url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/comments/196447634","html_url":"https://github.com/swcarpentry/python-novice-inflammation/pull/244#issuecomment-196447634","issue_url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/244","id":196447634,"user":{"login":"willingc","id":2680980,"avatar_url":"https://avatars.githubusercontent.com/u/2680980?v=3","gravatar_id":"","url":"https://api.github.com/users/willingc","html_url":"https://github.com/willingc","followers_url":"https://api.github.com/users/willingc/followers","following_url":"https://api.github.com/users/willingc/following{/other_user}","gists_url":"https://api.github.com/users/willingc/gists{/gist_id}","starred_url":"https://api.github.com/users/willingc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willingc/subscriptions","organizations_url":"https://api.github.com/users/willingc/orgs","repos_url":"https://api.github.com/users/willingc/repos","events_url":"https://api.github.com/users/willingc/events{/privacy}","received_events_url":"https://api.github.com/users/willingc/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T18:07:03Z","updated_at":"2016-03-14T18:07:03Z","body":"@tbekolay I believe in the Novice Python lesson that covering functions is more important than methods of a class because 1) an understanding of functions is needed to grasp methods; 2) novices are learning quite a bit at once - the additional syntax with methods is not worth the cognitive load; 3) functions are relevant whether doing procedural, object oriented, or functional programming.\r\n\r\nI like this snippet from Allen Downey's book, [Think Like a CS in Python](http://www.greenteapress.com/thinkpython/thinkCSpy/html/chap14.html) which is open sourced on his website:\r\n\r\n>Methods are just like functions, with two differences:\r\n\r\n>Methods are defined inside a class definition in order to make the relationship between the class and the method explicit.\r\nThe syntax for invoking a method is different from the syntax for calling a function.\r\nIn the next few sections, we will take the functions from the previous two chapters and transform them into methods. This transformation is purely mechanical; you can do it simply by following a sequence of steps. If you are comfortable converting from one form to another, you will be able to choose the best form for whatever you are doing."}}