flexxui / pscript

Python to JavaScript compiler
http://pscript.readthedocs.io
BSD 2-Clause "Simplified" License
260 stars 25 forks source link

`int` does not support base #21

Closed Winand closed 6 years ago

Winand commented 6 years ago

int could use parseInt to support base. Something like this:

def _int(x, base=10):
    if isinstance(x, 'string'):
        return parseInt(x, base)
    else:
        return Math.ceil(x) if x < 0 else Math.floor(x)
almarklein commented 6 years ago

Good idea!