New submission from Sardorbek Imomaliev <imomal...@hey.com>:
Currently, in `bisect` examples `grade` function is declared with mutable default for `breakpoints` arugment. I suggest updating. https://github.com/sweeneyde commented > I would say that even though using mutable defaults is often undesirable, > there is no problem with it in this case: the body of the function does not > mutate the default. It's also probably faster than re-constructing a new list > at each function call. I would suggest opening an issue on > https://bugs.python.org/ if you want to discuss more. I agree that in this case it wouldn't matter because `breakpoints` are not mutated, but most of the time people copy from examples and adapt the code to their needs without giving it a second thought. In my opinion, it is a good practice to provide examples as foolproof as possible. ---------- assignee: docs@python components: Documentation messages: 409490 nosy: docs@python, imomaliev priority: normal pull_requests: 28548 severity: normal status: open title: doc: Fix bisect example using mutable function default type: enhancement versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46224> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com