c[:]()

Warren Stringer warren at muse.com
Fri Jun 1 13:22:29 EDT 2007


> And that your
> insisting on ``c[:]()`` instead of just ``c()`` seems to indicate you want
> a change that is quite surprising.  It would mean that a slice of a list
> returns an other type with the __call__ method implemented.

I am not insisting on anything. I use ``c[:]()`` as shorthand way of saying
"c() for c in d where d is a container"

Having c() support containers seems obvious to me. It jibes with duck
typing. Perhaps the title of this thread should have been: "Why don't
containers quack?"

A change is surprising only if it breaks something. I still haven't seen any
code that breaks by making such a change. Seeing such code would teach a
great deal.

 > Grok The Zen of Python (``import this`` at the interpreter prompt)?

I think this is incredibly cool.

> Write "pythonic" code?

Probably not yet; I'm still learning - I have yet to perfect my silly walk.
http://grampyshouse.net/cliches/images/sillywalk.jpg 




More information about the Python-list mailing list