Re: get_used_memory
Paul Rubin <[email protected]> Sun, 14 Jun 2026 18:18:26 -0700
| Newsgroups | comp.lang.python |
|---|---|
| Organization | A noiseless patient Spider |
| Message-ID | <[email protected]> |
Jon Ribbens <[email protected]> writes: >> { a : int(b)) for x in xs if (a,b := x.split()) } > No, for three reasons. Firstly, the lines with units result in x.split() > having 3 members, so you can't assign it to a 2-tuple. Oh yes I had intended to say x.split()[:2] but somehow left that out. > Secondly, it appears that (a, b := x) means "create a tuple whose > first member is a and whose second member is x, and also assign x to > b", which is not at all what we need. Yuck, I had expected tuple unpacking. Sounds like a pitfall comparable to "=" vs "==" that kept the := operator out of the language for so long. Oh well.