Message253479
| Author |
ezio.melotti |
| Recipients |
Sapphire Becker, ezio.melotti |
| Date |
2015年10月26日.16:50:28 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1445878228.37.0.168175154614.issue25484@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
As far as I understand, this is treated as "x < y < z" or "x == y == z":
>>> import ast
>>> ast.dump(ast.parse("1 < 2 < 3"))
'Module(body=[Expr(value=Compare(left=Num(n=1), ops=[Lt(), Lt()], comparators=[Num(n=2), Num(n=3)]))])
>>> ast.dump(ast.parse("1 == 2 == 3"))
'Module(body=[Expr(value=Compare(left=Num(n=1), ops=[Eq(), Eq()], comparators=[Num(n=2), Num(n=3)]))])'
>>> ast.dump(ast.parse("1 in 2 == 3"))
'Module(body=[Expr(value=Compare(left=Num(n=1), ops=[In(), Eq()], comparators=[Num(n=2), Num(n=3)]))])'
The following code is also valid and works as expected:
>>> 1 in [1] in [[1]]
True
>>> 2 not in [1] in [[1]]
True
Your example yields an unexpected result, but I'm not sure if and how it can be fixed. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年10月26日 16:50:28 | ezio.melotti | set | recipients:
+ ezio.melotti, Sapphire Becker |
| 2015年10月26日 16:50:28 | ezio.melotti | set | messageid: <1445878228.37.0.168175154614.issue25484@psf.upfronthosting.co.za> |
| 2015年10月26日 16:50:28 | ezio.melotti | link | issue25484 messages |
| 2015年10月26日 16:50:28 | ezio.melotti | create |
|