{"action":"created","issue":{"url":"https://api.github.com/repos/Code-Poets/coding-style/issues/3","repository_url":"https://api.github.com/repos/Code-Poets/coding-style","labels_url":"https://api.github.com/repos/Code-Poets/coding-style/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/Code-Poets/coding-style/issues/3/comments","events_url":"https://api.github.com/repos/Code-Poets/coding-style/issues/3/events","html_url":"https://github.com/Code-Poets/coding-style/issues/3","id":321902478,"number":3,"title":"Nadużywanie wartości domyślnych parametrów funkcji","user":{"login":"dybi","id":36961162,"avatar_url":"https://avatars0.githubusercontent.com/u/36961162?v=4","gravatar_id":"","url":"https://api.github.com/users/dybi","html_url":"https://github.com/dybi","followers_url":"https://api.github.com/users/dybi/followers","following_url":"https://api.github.com/users/dybi/following{/other_user}","gists_url":"https://api.github.com/users/dybi/gists{/gist_id}","starred_url":"https://api.github.com/users/dybi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dybi/subscriptions","organizations_url":"https://api.github.com/users/dybi/orgs","repos_url":"https://api.github.com/users/dybi/repos","events_url":"https://api.github.com/users/dybi/events{/privacy}","received_events_url":"https://api.github.com/users/dybi/received_events","type":"User","site_admin":false},"labels":[{"id":916119790,"url":"https://api.github.com/repos/Code-Poets/coding-style/labels/coding%20style","name":"coding style","color":"ebf702","default":false},{"id":916120181,"url":"https://api.github.com/repos/Code-Poets/coding-style/labels/python","name":"python","color":"a1f4c5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-10T11:41:15Z","updated_at":"2018-05-10T15:32:35Z","closed_at":null,"author_association":"NONE","body":"> Oprócz tego, myślę, że warto byłoby napisać o NIE nadawaniu wartości domyślnych wszystkim argumentom w funkcjach. W kodzie mamy sporo funkcji typu:\r\n\r\n```python\r\ndef weird_fun(param1=None, param2=None):\r\n    assert param1 is not None\r\n    assert isinstance(param2, str)\r\n   # some code \r\n```"},"comment":{"url":"https://api.github.com/repos/Code-Poets/coding-style/issues/comments/388090314","html_url":"https://github.com/Code-Poets/coding-style/issues/3#issuecomment-388090314","issue_url":"https://api.github.com/repos/Code-Poets/coding-style/issues/3","id":388090314,"user":{"login":"cameel","id":137030,"avatar_url":"https://avatars3.githubusercontent.com/u/137030?v=4","gravatar_id":"","url":"https://api.github.com/users/cameel","html_url":"https://github.com/cameel","followers_url":"https://api.github.com/users/cameel/followers","following_url":"https://api.github.com/users/cameel/following{/other_user}","gists_url":"https://api.github.com/users/cameel/gists{/gist_id}","starred_url":"https://api.github.com/users/cameel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cameel/subscriptions","organizations_url":"https://api.github.com/users/cameel/orgs","repos_url":"https://api.github.com/users/cameel/repos","events_url":"https://api.github.com/users/cameel/events{/privacy}","received_events_url":"https://api.github.com/users/cameel/received_events","type":"User","site_admin":false},"created_at":"2018-05-10T15:32:35Z","updated_at":"2018-05-10T15:32:35Z","author_association":"OWNER","body":"Hehe :), no ten przykład jest na tyle ekstremalny że można by go uznać za buga.\r\n\r\nAle ogólnie moim zdaniem jest wiele mniej oczywistych sytuacji i istnieje tendencja by na siłę dawać domyślną wartość dla wygody. Według mnie reguła powinna mówić, że unikamy nadawania wartości domyślnej tylko dlatego, że jakaś wartość parametru jest częściej używana niż inna i nie chce nam się jej ciągle pisać. Nadajemy je raczej w sytuacjach gdy dany parametr jest po prostu opcjonalny. Stąd też wynika to zalecenie, które już tam jest - żeby unikać wartości domyślnych innych niż pusty string czy `None`. Bo kiedy parametr jest opcjonalny to zwykle pomijamy go ustawiając `None`."}}
{"actor":{"display_login":"cameel"}}