len()

Ori Livneh ori.livneh at gmail.com
Tue Jan 27 18:15:51 EST 2009


I'm newish to Python, so this might be way off-base, but I think it this
might help: Allen Downey explains in "Think Python" that *"the syntax of a
function call suggests that the function is the active agent."* So you're
calling the function len() and telling it you have an object for it to
measure. By contrast, method invocations suggest that the objects are the
active agents. Python syntax does not always follow this implicit logic, but
I think it makes sense here.

On Tue, Jan 27, 2009 at 5:30 PM, Tobiah <toby at tobiah.org> wrote:

> Just out of curiosity, why was len() made to
> be it's own function?  I often find myself
> typing things like my_list.len before I
> catch myself.
>
> Thanks,
>
> Toby
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090127/c7e8dd9c/attachment.html>


More information about the Python-list mailing list