Boštjan Mejak <bostjan.xpe...@gmail.com> 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 whenever White makes a move. So, my 
implementation for row creation is math.ceil(len(moves) // 2) where moves is a 
list of chess moves. 

So, the sequence of table rows after White and Black make their moves is 
initially 0 (since there are no moves yet) and then 1 (first row created after 
White made a move) and then 1 (again on row 1 after Black made a move, but on 
column 2), then 2 2 3 3 4 4 5 5 6 6 and so on.

If we had the ceil operator in Python, I could do: len(moves) /// 2 :)

By the way -- do you happen to know any better idea to get that kind of a 
sequence? That is 0 1 1 2 2 3 3 4 4 5 5 6 6 and so on.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43255>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to