c[:]()

Grant Edwards grante at visi.com
Fri Jun 1 20:28:42 CEST 2007


On 2007-06-01, Warren Stringer <warren at muse.com> wrote:

>> 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"

Once again, that's gibberish.  Where does "d" come from? c[:]()
and c() _ARE_THE_SAME_THING_.  c[:]() is another way of saying
c() PERIOD.  "d" doesn't enter into it, and by no stretch of
the imagination is c[:]() "shorthand" for c() since it's
_twice_as_long_.

> Having c() support containers seems obvious to me.

Again, that sentence appears to me to be meaningless.  "c()"
doesn't "support" anything.  "c()" is just syntax that says to
invoke the __call__ method of the object to which the name "c"
is bound.

> It jibes with duck typing.

To what does "it" refer?

> Perhaps the title of this thread should have been: "Why don't
> containers quack?"

I'm not sure where you're getting your vocabularly, but it
seems to be completely foreign.

> 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.

If I show you some, will that make you happy?

-- 
Grant Edwards                   grante             Yow! Where does it go when
                                  at               you flush?
                               visi.com            



More information about the Python-list mailing list