Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

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>]

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34644>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to