Problems using struct pack/unpack in files, and reading them.

Chris Angelico rosuav at gmail.com
Fri Nov 13 22:57:43 EST 2015


On Sat, Nov 14, 2015 at 2:48 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
>> Yes, unary minus has the same issue - but it's a lot more important
>> than unary plus is. In ECMAScript, unary plus means "force this to be
>> a number"; what's its purpose in Python?
>
> I'm not sure "force this to be a number" is really a justification. Without
> it you could just use - - (but be careful not to write that as --) in the
> manner of using !! as "force to boolean". Or just call Number().

I don't use it myself, but I saw something about asm.js that
demonstrated the use of "x = +x;" to mean "x is a number", and "x =
x|0;" to mean "x is an integer".

ChrisA



More information about the Python-list mailing list