Question about consistency in python language
Dave Benjamin
dave.benjamin at gmail.com
Thu Sep 8 23:28:11 EDT 2005
Mike Meyer wrote:
> Dave Benjamin <ramen at lackingtalent.com> writes:
>
>>Python is actually quite consistent in this regard: methods that
>>modify an object in-place return None;
>
> Um, no. list.pop comes to mind as an immediate counterexample. It may
> be the only one...
I'm sure there are counterexamples... maybe 95% is too optimistic.
Anyone want to volunteer to compile some stats? ;)
I've never had to look up the return type of "pop" though. The only
thing even remotely ambigious about that term (at least, if you've
learned what a stack is) is whether it mutates the object, but I don't
think I've ever seen a "pop" that didn't (aside from toy examples in
formal methods / ADT related classes).
"os.system" might be a better example, since the return value could be
one of two obvious things: the status code, or the program's output.
Dave
More information about the Python-list
mailing list