Op 12-04-15 om 09:58 schreef Alan Gauld:

Aside:
Normally you would use the help() function to find out
how methods work and what they return but sadly the
documentation for the in-place methods doesn't indicate
the return is None. Some of them have a warning that
its "IN PLACE" but remove does not. Which is a pity.

>>> 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
(END)

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

remove(...)
    L.remove(value) -- remove first occurrence of value.
    Raises ValueError if the value is not present.
(END)

Personally I think it would help if the first lines
for these methods read like:

remove(...) -> None
   L.remove...etc
Are you using Python 2? Because this is what I get in Python 3:

remove(...)
    L.remove(value) -> None -- remove first occurrence of value.
    Raises ValueError if the value is not present.

The same for help(list.sort) BTW.

Timo
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to