[Python-Dev] Extending tuple unpacking

Steven Bethard steven.bethard at gmail.com
Tue Oct 11 20:09:01 CEST 2005


Nick Coghlan wrote:
> So my vote would actually go for deprecating the use of square brackets to
> surround an assignment target list - it makes it look like an actual list
> object should be involved somewhere, but there isn't one.

I've found myself using square brackets a few times for more
complicated unpacking, e.g.:

try:
    x, y = args
except ValueError:
    [x], y = args, None

where I thought that

    (x,), y = args, None

would have been more confusing.  OTOH, I usually end up rewriting this to

    x, = args
    y = None

because even the bracketed form is a bit confusing.  So I wouldn't
really be upset if the brackets went away.

STeVe
--
You can wordify anything if you just verb it.
        --- Bucky Katt, Get Fuzzy


More information about the Python-Dev mailing list