This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients rajesh99div99, steven.daprano
Date 2018-09-12.13:25:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1536758713.98.0.956365154283.issue34644@psf.upfronthosting.co.za>
In-reply-to
Content
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>]
History
Date User Action Args
2018-09-12 13:25:14steven.dapranosetrecipients: + steven.daprano, rajesh99div99
2018-09-12 13:25:13steven.dapranosetmessageid: <1536758713.98.0.956365154283.issue34644@psf.upfronthosting.co.za>
2018-09-12 13:25:13steven.dapranolinkissue34644 messages
2018-09-12 13:25:13steven.dapranocreate