[issue43255] Ceil division with /// operator

2022-02-04 Thread Nathaniel Manista
Change by Nathaniel Manista : -- nosy: +Nathaniel Manista ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue43255] Ceil division with /// operator

2021-02-19 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue43255] Ceil division with /// operator

2021-02-19 Thread Boštjan Mejak
Boštjan Mejak added the comment: Mr. Stinner, I really don't understand what are you hinting at. -- ___ Python tracker ___ ___ Pytho

[issue43255] Ceil division with /// operator

2021-02-18 Thread STINNER Victor
STINNER Victor added the comment: > Mr. Stinner, in what way would int.bit_count() be beneficial to me? I found https://www.chessprogramming.org/Population_Count when I investigated the C implementation of _Py_popcount32(), which is used by int.bit_count(). I read it when I tried to document

[issue43255] Ceil division with /// operator

2021-02-18 Thread Boštjan Mejak
Boštjan Mejak added the comment: My hat off to you, Mr. Peters! Your suggestion (len(moves) + 1) // 2 works perfectly and is much more elegant than --0-- len(moves) // 2. :) Mr. Stinner, in what way would int.bit_count() be beneficial to me? -- ___

[issue43255] Ceil division with /// operator

2021-02-18 Thread STINNER Victor
STINNER Victor added the comment: > Anyway, my need for ceiling is that I am coding a chess GUI where I have a > table with 2 columns and I create a new row whenever White makes a move. So, > my implementation for row creation is math.ceil(len(moves) // 2) where moves > is a list of chess mo

[issue43255] Ceil division with /// operator

2021-02-18 Thread Tim Peters
Tim Peters added the comment: (len(moves) + 1) // 2 -- nosy: +tim.peters ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue43255] Ceil division with /// operator

2021-02-18 Thread Boštjan Mejak
Boštjan Mejak added the comment: The spaceship operator is kinda cool! :) Well, I was hoping to avoid importing the math module just to have ceil division capabilities. Anyway, my need for ceiling is that I am coding a chess GUI where I have a table with 2 columns and I create a new row when

[issue43255] Ceil division with /// operator

2021-02-18 Thread Mark Dickinson
Change by Mark Dickinson : -- resolution: not a bug -> rejected ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe

[issue43255] Ceil division with /// operator

2021-02-18 Thread Mark Dickinson
Mark Dickinson added the comment: I can't recall where I saw this originally, but you can use the spaceship operator "--0--" to turn floor division into ceiling division: >>> 12//5 2 >>> --0-- 12//5 3 There's also the ++0++ operator when you want to emphasize that you really *do* mean floor

[issue43255] Ceil division with /// operator

2021-02-18 Thread STINNER Victor
STINNER Victor added the comment: I'm not convinced that this operation is so common that it deserves a new operator. As Serhiy wrote, it must be first on python-ideas first. I close the issue. -- floor division is x//y integer ceil division can be implemented with math.ceil(x/y) for small

[issue43255] Ceil division with /// operator

2021-02-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Since adding new operator is a syntax-level change, it needs a PEP. It is better to start with discussing on the Python-ideas mailing list (https://mail.python.org/mailman3/lists/python-ideas.python.org/). Let's see if this idea will be accepted favorably.

[issue43255] Ceil division with /// operator

2021-02-18 Thread Boštjan Mejak
New submission from Boštjan Mejak : I hope I'm not too late for a Python 3.10 feature request. I love the fact that Python 3.x does floor division with the // operator. We, however, don't have a ceil division operator, besides importing the math module and using its math.ceil() function. Is i