Erik Max Francis max at alcyone.com
Fri Jun 1 08:26:33 CEST 2007

Warren Stringer wrote:

> `c[:]()` is unambiguous because:
>     def c(): print 'yo'
>     c()     # works, but
>     c[:]()  # causes:
>     Traceback (most recent call last)...
>         c[:]()  # causes:
>     TypeError: unsubscriptable object
> There are many `c()` to be found in the wild and no `c[:]()`, thus
> unambiguous. To be honest, I wasn't sure, until testing this, just now.

 >>> c = 'not quite'
 >>> c[:]
'not quite'
 >>> c[:]()
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: 'str' object is not callable

You also seem to be under the impression that `x[:]()` is somehow 
special syntax that is treated differently than `y = x[:]; y()`.  It is not.

Besides, _ambiguity_ was never the problem.  _Functionality_ is the problem.

Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
   To endure what is unendurable is true endurance.
    -- (a Japanese proverb)

More information about the Python-list mailing list