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


Groups > comp.lang.python > #197818

Re: get_used_memory

Path csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.python
Subject Re: get_used_memory
Date Mon, 15 Jun 2026 12:02:52 -0700
Organization A noiseless patient Spider
Lines 22
Message-ID <87pl1r62zn.fsf@nightsong.com> (permalink)
References <110fvf3$1tqe3$1@dont-email.me> <slrn112nclh.5fs.jon+usenet@raven.unequivocal.eu> <8733yq9qov.fsf@nightsong.com> <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> <slrn112rnrs.5fs.jon+usenet@raven.unequivocal.eu> <877bo07itf.fsf@nightsong.com> <slrn112uifb.5fs.jon+usenet@raven.unequivocal.eu> <87tsr461p9.fsf@nightsong.com> <slrn112v9t5.5fs.jon+usenet@raven.unequivocal.eu>
MIME-Version 1.0
Content-Type text/plain
Injection-Date Mon, 15 Jun 2026 19:02:53 +0000 (UTC)
Injection-Info dont-email.me; logging-data="617704"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hW3ngAyvCJNqX+WweecLF"; posting-host="70ba9729fdd7937c4d720e4250c15068"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock sha1:Xv/M3T1/6/93qiS6QYR41RuI5sw= sha1:g4G6FM2xd7FtbJIIGbY/qEy38mM= sha256:GyRsh0QS5agFAtbgXC4Y96zuhmhiwNsPMIiTPG4FqXw= sha1:+BGhQ+Xt3KCveseylaBYSCBlR8c=
Xref csiph.com comp.lang.python:197818

Show key headers only | View raw


Jon Ribbens <jon+usenet@unequivocal.eu> writes:
> My biggest complaint about := is the arbitrary and mysterious
> restrictions on what you can use on the left hand side. You can't
> even say "a.b := c". The PEP that introduced ":=" barely even
> mentions these restrictions, let alone discusses or explains them.

Yeah that's pretty annoying.  Haskell doesn't have destructive
assignments at all, but you can put the equivalent of match/case inside
expressions.  So, something like:
   
   fromList [(a, read b) | (a:b:_) <- words x | x <- xs] :: Map String Int

The vertical bar is like "for" in Python's list comprehensions, "read"
is like int(str) except it converts to arbitrary datatypes, "words" is
like "split", and ":: Map String Int" is a type annotation that says
it's making a dictionary mapping strings to Ints.  The Int type
signature tells "read" to convert to ints instead of floats or whatever.
Finally, (a:b:_) binds the first two elements of x.split() and throws
away the rest.

I haven't tested the above so maybe I did something dumb.  I haven't
written any Haskell in a while.

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