import x as y

Rainer Deyke root at rainerdeyke.com
Tue Oct 31 20:02:54 EST 2000


"Grant Edwards" <grante at visi.com> wrote in message
news:txFL5.5284$FU3.1232143 at ptah.visi.com...
> In article <mVEL5.145182$g6.66741488 at news2.rdc2.tx.home.com>, Rainer Deyke
wrote:
>
> >On a related note, I want the following to work:
> >
> >l = [0]
> >def l[0]():
> >  pass
>
> Well, it doesn't.
>
> Perhaps you can explain a little further _why_ you want that to
> work and perhaps we can suggest an alternative means to that end.

Two reasons, neither of them terribly important:

1. Consistency.  A def statement is an assignment, and should therefore be
consistent with other assignments in its possible targets.

2. The ability to create dispatch tables with minimal noise.  I could just
use "def f():pass\nl[0] = f\ndel f\n", but that takes two extra lines.  It's
a hypothetical problem anyway, since I'm not currently using any dispatch
tables.


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list