On 4/28/2014 11:45 AM, taserian wrote:

Is there some sort of rule-of-thumb to determine if a function is
in-place or returns a value?

my rule of thumb is to ask:


Python 2.7.5 (default, May 15 2013, 22:44:16)
[MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help([].sort)
Help on built-in function sort:

sort(...)
    L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;
    cmp(x, y) -> -1, 0, 1

>>> help([].reverse)
Help on built-in function reverse:

reverse(...)
    L.reverse() -- reverse *IN PLACE*

>>>



The *IN PLACE* tells me.

HTH,

Emile

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to