3 ms·
python does this to be consistent with C, not the other way around.
by wayn3 9y ago
python does this to be consistent with C, not the other way around.
- thaumasiotes 9y agoJava was a lot more concerned with being consistent with C, but in Java where a boolean is called for you have to actually supply a boolean. It's one of those rare features that I wish other languages would adopt from Java. Possibly the only one. :/
- wayn3 9y agoi dont really get the problem. especially in the case of modulo, it often makes sense to just treat the result like a boolean, because it practically says "divisible yes/no". theres nothing i remotely like about java and its great that python isnt trying to be like java, but those are just opinions. is your complaint about the implicit typecast or about the fact that integer can be cast to boolean at all? if its the former then python is just less pointlessly verbose than java. the latter may make sense to complain about.