[Tutor] adding methods to native types

Sean 'Shaleh' Perry shalehperry@attbi.com
Wed Feb 5 23:45:01 2003


On Wednesday 05 February 2003 20:52, Erik Price wrote:
> On Wednesday, February 5, 2003, at 11:24  PM, Sean 'Shaleh' Perry wrote=
:
> > Rather than fight it, you should learn to enjoy the functional choice=
s
> > available to you.  Many of us find the mix fun and less effortless.
>
> Fun is definitely cool, but what I was looking for choosing Python over
> Java for that quick script would be that it is *more* effortless... !
>
> :)
>
> Erik

I find len(foo) less of a pain than object.len() -- if nothing else I sav=
e one=20
character (no dot (-:)  But that is just me.

The nice thing about functions is you can pass any object to them. len() =
works=20
on any object that supports __len__().