list[] = var => list.append(var) (phpstyle)

Alex Martelli aleaxit at yahoo.com
Sat Jul 14 17:59:24 EDT 2001


"Jonas Bengtsson" <jonas.b at home.se> wrote in message
news:4e2ddb70.0107141310.3c7ca355 at posting.google.com...
> I think it should be neet if it would be possible to append a variable
> to a list by just using
> list_var[] = var_to_append
> It works that way in PHP and I think it's nice.
>
> Any comments?

    list_var += var_to_append

(which is how you express this today in Python) is equivalent
and shorter.  Python does NOT go out of its way to provide
a zillion ways to write the same, identical thing.


Alex






More information about the Python-list mailing list