[issue39054] Add an parameter to list.remove()
New submission from Lovi <1668151...@qq.com>: I think the list can add a parameter to remove(): remove(value, appear_time=1, /) The parameter appear_time indicates the number of times the value appears in the list. I want this effect: >>> list1 = [1, 2, 3, 2, 1, 2, 1] >>> list1.remove(2, 2) >>> list1 [1, 2, 3, 1, 2, 1] >>> list1.remove(1, 3) >>> list1 [1, 2, 3, 1, 2] -- messages: 358420 nosy: lovi priority: normal severity: normal status: open title: Add an parameter to list.remove() type: enhancement versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue39054> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39046] collections.abc.Reversible should not be a subclass of Hashable
Change by Lovi <1668151...@qq.com>: -- nosy: +lovi versions: -Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue39046> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39045] Segmentation of string
New submission from Lovi <1668151...@qq.com>: I thought for a long time. I think it's necessary to add a segment method to str type or string module. This method is used to split a string into m parts and return all cases. For example: segment('1234', m=3) -> [('1', '2', '34'), ('1', '23', '4'), ('12', '3', '4')] segment('12345', m=3) -> [('1', '2', '345'), ('1', '23', '45'), ('1', '234', '5'), ('12', '3', '45'), ('12', '34', '5'), ('123', '4', '5')] I hope this proposal can be adopted. -- components: Library (Lib) messages: 358383 nosy: lovi priority: normal severity: normal status: open title: Segmentation of string type: enhancement versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue39045> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39043] Add math.fib() generator
New submission from Lovi <1668151...@qq.com>: I think it's appropriate to add the generator fib() to the math module. With fib(), some operations will be easier. The generator is like this: def fib(count=None): if count is not None and not isinstance(count, int): raise ValueError(f"Parameter count has an unexpected type: {count.__class__.__name__}.") a, b = 0, 1 while True: a, b = b, a + b if count is not None: if not count: return count -= 1 yield a -- components: Library (Lib) messages: 358375 nosy: lovi priority: normal severity: normal status: open title: Add math.fib() generator type: enhancement versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue39043> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39036] Add center_char attribute to str type
Lovi <1668151...@qq.com> added the comment: Sorry, I made a mistake. The center char of '12345' is '3' and the center char of 'abcd' is '' because it doesn't have the most central character. In my opinion, with center_char, when you need the center character of a string you can get it directly with str.center_char instead of tedious index and calculation. -- ___ Python tracker <https://bugs.python.org/issue39036> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39036] Add center_char attribute to str type
New submission from Lovi <1668151...@qq.com>: I think Python3.9 needs to add the center_char attribute which means the center character of strings to string type, such as the center_char of '12345' is '1' and the center_char of 'abcd' is 'bc'. -- components: Windows messages: 358328 nosy: lovi, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Add center_char attribute to str type type: enhancement versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue39036> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com