[issue24146] ast.literal_eval doesn't support the Python ternary operator

2015-05-08 Thread R. David Murray
R. David Murray added the comment: Right, this isn't a bug, it is that literal_eval is intended only to support *literals*, not expressions. See also issue 22525. -- nosy: +r.david.murray resolution: -> not a bug stage: needs patch -> resolved status: open -> closed _

[issue24146] ast.literal_eval doesn't support the Python ternary operator

2015-05-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: No it doesn't support all Python operators. >>> ast.literal_eval('2*3') Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.4/ast.py", line 84, in literal_eval return _convert(node_or_string) File "/usr/lib/python3.4/ast.py

[issue24146] ast.literal_eval doesn't support the Python ternary operator

2015-05-08 Thread Larry Hastings
New submission from Larry Hastings: ast.literal_eval() supports all Python operators, yes? No. It doesn't support "if/else", Python's ternary operator. Is there a reason it does not? I think it probably should. -- messages: 242760 nosy: benjamin.peterson, georg.brandl, larry priorit