Simple list.append() question
Christian Tismer
tismer at tismer.com
Fri Apr 28 09:21:45 EDT 2000
Michael Hudson wrote:
>
> Greg Ewing <greg at cosc.canterbury.ac.nz> writes:
>
> > Bernhard Herzog wrote:
> > >
> > > It would be a good idea IMO to find a
> > > good syntax for this case and ISTM that list comprehensions might be
> > > useful here:
> > >
> > > multi_list = [[] for i in range(10)]
> > >
> > > or whatever the precise syntax was. Hmm, the unused variable in there is
> > > a bit ugly though.
> >
> > Maybe the LC syntax should include something like
> >
> > [[] times 10]
>
> But wouldn't that make "times" a keyword? Not sure I'd want that...
Currently, yes, but it is absolutely not necessary to be so.
It requires to change the grammar to treat operators
differently. A similar change would allow me to use
def foo(from=1, to=42):
...
since there is no reason to recognise from as a keyword in
parameter position. Similarily: in
class foo:
def impossible(self, a, b, c):
self.pass = a
self.continue = b
self.return = c
could quite easily be allowed.
But I'm tired to fight such a proposal again for no result...
ciao - chris
--
Christian Tismer :^) <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaunstr. 26 : *Starship* http://starship.python.net
14163 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
where do you want to jump today? http://www.stackless.com
More information about the Python-list
mailing list