On 2006-10-25, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Kenneth McDonald: >> not being able to do things like '[1,2,3]'.length >> drives me a little nuts. > > This is interesting, why? > (In a computer language too much purity is often bad. And isn't > [1,2,3].len better?) > > I think you can't add methods to Python builtin classes, I > think you can do it with Ruby.
You can create derived versions of builtins with new methods (which affords the benefits of modifying builtins), but you can't change the type of a Python literal. So the above would be MyList([1,2,3]).len -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list