[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Sardorbek Imomaliev
Sardorbek Imomaliev added the comment: Understood, thanks for clarification. -- ___ Python tracker ___ ___ Python-bugs-list

[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm going to decline this one. It seems that you're applying a stylistic guideline to a case where it isn't needed and where it doesn't improve the example. In this case, the example doesn't mutate the input, so the code is correct. It has some

[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Dennis Sweeney
Change by Dennis Sweeney : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Sardorbek Imomaliev
Sardorbek Imomaliev added the comment: It was changed from that in 2010 https://github.com/python/cpython/commit/20933e08b12b4e66c6e1baf662a679b4008d9dce -- ___ Python tracker

[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Dennis Sweeney
Dennis Sweeney added the comment: Another option would be to use globals: >>> BREAKPOINTS = [60, 70, 80, 90] >>> GRADES = "FDCBA" >>> def grade(score): ... i = bisect(BREAKPOINTS, score) ... return GRADES[i] ... >>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]] ['F', 'A',

[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Alex Waygood
Change by Alex Waygood : -- keywords: +patch stage: -> patch review versions: -Python 3.6, Python 3.7, Python 3.8 ___ Python tracker ___

[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Sardorbek Imomaliev
New submission from Sardorbek Imomaliev : 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, >