[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Re: Pygame not handling keyboard tracking correctly



Feel free to show the docs that contradict this, but this is not
correct. In fact, I think you are talking about Javascript rather than
Python.

On lun, 2014-06-23 at 11:06 -0700, Berlioz Silver wrote:
> If someone had read the python docs, they'd have known exactly why
> this occurs.
> * some people want to know if the number they got IS EXACTLY 3 and
> won't do wonky stuff when they multiply it.

We have just explained it, and this is not the reason. If a value is
equal to (==) 3, then it is exactly equal to 3. But, as previously
discussed (particularly with numbers above 255), a value of 3 does not
need to be the same object (is) as another 3. They can be two identical
numbers, stored in the same way, but as separate objects in memory, thus
return False when tested with 'is'. This is clearly demonstrated with:
        >>> a = 2020
        >>> a is 2020  # False

So, it has absolutely nothing to do with multiplication.

> Thus we have 4 operators for equality comparisons:
> == (eq)
> === (is)

That's 2 operators, and one doesn't exist in Python, again, you may be
thinking of Javascript. The operators are '==' and 'is'.

Attachment: signature.asc
Description: This is a digitally signed message part