Closed benstopics closed 8 years ago
This is true, so? It's intended behavior.
I don't understand how this is helpful. If the string is clearly all digits, why would you use a leading zero to prevent the string from being invalidated? You would use some other character.
So you want v
to work like s
on strings of digits? Sounds reasonable.
I would like to golf Project Euler challenges and # 11 provides a 20x20 grid of numbers all two digits (the single digit values having a leading zero). It was easy to just regex remove the leading digits, but I think it would look cleaner without having to use regex. If this shouldn't be a behavior of r<str>7
, then maybe a new mode would be helpful, even r<str>-7
r<str>_7
. I'm not sure if using negative numbers for mode changers has been considered or is practical.
I see the point. Yeah, that's probably worth changing. Will do.
Fixed.
literal_eval
does not evaluate numbers with leading zeros.ex. =>
v"08"
yields =>Traceback (most recent call last): File "pyth.py", line 683, in <module> File "<string>", line 3, in <module> File "/app/.heroku/python/lib/python3.4/ast.py", line 46, in literal_eval File "/app/.heroku/python/lib/python3.4/ast.py", line 35, in parse File "<unknown>", line 1 08 ^ SyntaxError: invalid token