On Sun, 31 Jul 2016 13:32:16 +1000
Steven D'Aprano <st...@pearwood.info> wrote:
> Many beginners make the mistake of writing:
> 
> mylist = mylist.sort()
> 
> or try to write:
> 
> mylist.sort().reverse()
> 
> If we had procedures, that would be an obvious error (possibly even a
> compile-time syntax error) instead of a perplexing source of mystery
> bugs.

While neither is a syntax error, the latter is definitely a run-time
error:

>>> mylist.sort().reverse()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'reverse'

-- 
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@vex.net
VoIP: sip:da...@vex.net
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to