list comprehensions value assignment syntax error

Steve Holden sholden at holdenweb.com
Wed Jan 8 13:11:27 EST 2003


"Gerrit Holl" <gerrit at nl.linux.org> wrote in message
news:mailman.1042038162.14439.python-list at python.org...
> Steve Holden schreef op woensdag  8 januari om 01:36:49 +0000:
> > > I am trying to assign to a list item using list comprehensions, but
this
> > > raises a SyntaxError:
> >
> > You've been around this group long enough to know where to consult the
FAQ,
>
> I am really sorry about this one. I did consult the FAQ but only on 'list
> comprehensions', so I did not find number 6.30:
>
> http://www.python.org/cgi-bin/faqw.py?req=show&file=faq06.030.htp
> "Why can't I use an assignment in an expression?"...
>
> I did not realise my questien was really about this and not about list
> comprehensions. I should have been able to identify my problem as being
> this; I should have thought harder before posting to the list, sorry.
>
> I hope you can forgive me <w> ;),

Easily. I take it what you actually wanted was to construct the list using
the comprehension?

regards
-----------------------------------------------------------------------
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/
Bring your musical instrument to PyCon!    http://www.python.org/pycon/
-----------------------------------------------------------------------







More information about the Python-list mailing list