Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197809

Re: get_used_memory

From Jon Ribbens <jon+usenet@unequivocal.eu>
Newsgroups comp.lang.python
Subject Re: get_used_memory
Date 2026-06-13 22:53 +0000
Organization A noiseless patient Spider
Message-ID <slrn112rnrs.5fs.jon+usenet@raven.unequivocal.eu> (permalink)
References (3 earlier) <slrn112rdj8.5fs.jon+usenet@raven.unequivocal.eu> <slrn112rdrf.5fs.jon+usenet@raven.unequivocal.eu> <878q8i87p7.fsf@nightsong.com> <slrn112rj8p.5fs.jon+usenet@raven.unequivocal.eu> <874ij684ls.fsf@nightsong.com>

Show all headers | View raw


On 2026-06-13, Paul Rubin <no.email@nospam.invalid> wrote:
> Jon Ribbens <jon+usenet@unequivocal.eu> writes:
>> Lawrence's version used your neat dict(line.split()[:2] ...) trick.
>
> Maybe this:
>
>    dict((a,int(b)) for a,b in (x.split()[:2] for x in xs))
>
> I feel like there should be a way to do this with the := operator
> instead of the nested generators, but it doesn't seem to be there.

That was the way my version did it? If I use abbreviated variable names
like your version, it's actually shorter than yours ;-)

     {e[0][:-1]: int(e[1]) for x in xs if (e := x.split())}

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

get_used_memory Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-06-12 03:46 +0000
  Re: get_used_memory Jon Ribbens <jon+usenet@unequivocal.eu> - 2026-06-12 07:18 +0000
    Re: get_used_memory Paul Rubin <no.email@nospam.invalid> - 2026-06-13 12:38 -0700
      Re: get_used_memory Jon Ribbens <jon+usenet@unequivocal.eu> - 2026-06-13 19:58 +0000
        Re: get_used_memory Jon Ribbens <jon+usenet@unequivocal.eu> - 2026-06-13 20:02 +0000
          Re: get_used_memory Paul Rubin <no.email@nospam.invalid> - 2026-06-13 14:13 -0700
            Re: get_used_memory Jon Ribbens <jon+usenet@unequivocal.eu> - 2026-06-13 21:35 +0000
              Re: get_used_memory Paul Rubin <no.email@nospam.invalid> - 2026-06-13 15:20 -0700
                Re: get_used_memory Jon Ribbens <jon+usenet@unequivocal.eu> - 2026-06-13 22:53 +0000
                Re: get_used_memory Paul Rubin <no.email@nospam.invalid> - 2026-06-14 17:23 -0700
                Re: get_used_memory Jon Ribbens <jon+usenet@unequivocal.eu> - 2026-06-15 00:40 +0000
                Re: get_used_memory Paul Rubin <no.email@nospam.invalid> - 2026-06-14 18:18 -0700
                Re: get_used_memory Jon Ribbens <jon+usenet@unequivocal.eu> - 2026-06-15 07:20 +0000
                Re: get_used_memory Paul Rubin <no.email@nospam.invalid> - 2026-06-15 12:02 -0700
                Re: get_used_memory Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-06-14 01:10 +0000
      Re: get_used_memory Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-06-14 01:09 +0000
        Re: get_used_memory Paul Rubin <no.email@nospam.invalid> - 2026-06-14 01:28 -0700
          Re: get_used_memory Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-06-14 23:56 +0000

csiph-web