Re: get_used_memory

Paul Rubin <[email protected]> Sun, 14 Jun 2026 17:23:24 -0700
Newsgroups comp.lang.python
Organization A noiseless patient Spider
Message-ID <[email protected]>
Jon Ribbens <[email protected]> writes:
>      {e[0][:-1]: int(e[1]) for x in xs if (e := x.split())}

Does this work?

 { a : int(b)) for x in xs if (a,b := x.split()) }

I think it's ok to keep the ':' in the field name.  Otherwise

 { a.rstrip(':') : int(b)) for x in xs if (a,b := x.split()) }

seems a bit more explicit at the expense of a few more chars.