[program-l] Re: Silly Python Question

  • From: "Littlefield, Tyler" <tyler@xxxxxxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Tue, 16 Oct 2012 08:24:47 -0600

Because len and the others call foo.__len__. It's a quick way at getting at those methods without having to call them yourself, so any class can implement a __len__ method and len would work on it.

On 10/16/2012 7:08 AM, Homme, James wrote:

Hi,

I tend to obsess about things sometimes. I was looking at the Python Standard Library documentation and reading about lists, dictionaries, and files, and I started to wonder why len, del, and open are part of the built-in's, if that's the right term, rather than methods of the objects called dictionary, list, and file. Just saying.

Jim


------------------------------------------------------------------------

This e-mail and any attachments to it are confidential and are intended solely for use of the individual or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not keep, use, disclose, copy or distribute this e-mail without the author's prior permission. The views expressed in this e-mail message do not necessarily represent the views of Highmark Inc., its subsidiaries, or affiliates.


--
Take care,
Ty
http://tds-solutions.net
The aspen project: a barebones light-weight mud engine:
http://code.google.com/p/aspenmud
He that will not reason is a bigot; he that cannot reason is a fool; he that 
dares not reason is a slave.

Other related posts: