Pycraft: Minecraft engine in Python
I cringe when I see code like this:
    if len(vals) in range(1, 5):<p>It seems like a harmless enough thing to do but that code is effectively creating a new array with values [1, 2, 3, 4, 5] and testing if the result of len() is in that array by iterating over it. This check is happening multiple times for each draw call every frame.<p>Sadly I see this kind of stuff in Python all the time and it just adds weight to the argument that Python is not a performant language. 1 &lt;= len(vals) &lt;= 5 would have been more pythonic and certainly more efficient (and obvious) but I have to wonder if under the hood it&#x27;s just doing the same inefficient operation.