Message325137
This is not a bug or a syntax error, and the behaviour goes back to at least Python 1.5 if not older.
List.reverse returns a reference to the method object itself. List.reverse() *calls* the method. This is standard behaviour in Python, all methods and functions are first-class values, anything you can do with an object, you can do with a function or method too. For example:
py> list.reverse.__name__
'reverse'
py> print(len)
<built-in function len>
py> alist = [1, "a", chr]
py> print(alist)
[1, 'a', <built-in function chr>] |
|
Date |
User |
Action |
Args |
2018-09-12 13:25:14 | steven.daprano | set | recipients:
+ steven.daprano, rajesh99div99 |
2018-09-12 13:25:13 | steven.daprano | set | messageid: <1536758713.98.0.956365154283.issue34644@psf.upfronthosting.co.za> |
2018-09-12 13:25:13 | steven.daprano | link | issue34644 messages |
2018-09-12 13:25:13 | steven.daprano | create | |
|