1

I should be able to turn a value up to (2**64)-1 into a zero-padded, 16-hex-nibble string... So why does the below error out when I get up to a size beyond 2**52?

>>> a = "{:016X}".format(2**52)
>>> a = "{:016X}".format(2**53)
Traceback (most recent call last):
  File <string>, line 1, in <module>
TypeError: non-empty format string passed to object.__format__

Could this have to do with limitations in Brython, which is converting things to javascript? (Because I get that error in the Brython REPL here, but not in a local normal Python3 REPL)

Jimmy Wu
  • 149
  • 7
  • The biggest value that you can use that doesn't cause an error is `(2**53)-2`. No doubt this is caused by the conversion to JS, and Brython not doing the right thing with a JS BigInt – Anon Coward Mar 03 '21 at 20:40

1 Answers1

1

Looks like the developers confirmed it was a bug: https://github.com/brython-dev/brython/issues/1624

Jimmy Wu
  • 149
  • 7