flying sheep added the comment: > isn't it logical? > > [] is a mutable data structure > while () is a immutable data structure
but you don’t assign to data structures, but to names. you *modify* data structures. and in the square bracket assignment syntax you don’t modify the list created by the []. in fact the [] never even create a list. ————————————————————————————— also it’s news to me that [a, b] = range(2) works! i always did a, b = range(2), and knew that (a, b) = range(2) works. but assigning to something looking like a list literal is new and surprising to me. (and i thought i’ve mastered every corner of python’s syntax) ---------- nosy: +flying sheep _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23275> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com