3 ms·
I just discovered being able to use Python to convert a number to a different base: >>> int(‘x’, y) ...where x is the string/number you want to convert and y
by farleykr 8y ago
I just discovered being able to use Python to convert a number to a different base:
>>> int(‘x’, y)
...where x is the string/number you want to convert and y is the base.
I haven’t found a practical use case but it’s been a lot of fun to play with.
- jwilk 8y agoIt's not a syntactic feature, so it can't be syntactic sugar. Also, it's available in many (most?) other languages: C (strtol), C++ (std::stoi), JavaScript (parseInt), PHP (intval), ...