[ANN] Pterocos - Free browser-based Python editor (plus C#, Rust, Ruby, SQL, Lua)

2026-06-13 Thread Facha Nf via Python-list
I built Pterocos (https://pterocos.eu.org) - a free online editor that runs Python (plus C#, Rust, Ruby, SQL, Lua) entirely in your browser. No installation, no account required. **Key features:** - Runs client-side via WebAssembly (your code never leaves your browser) - Syntax highlighting for al

Re: get_used_memory

2026-06-13 Thread Jon Ribbens via Python-list
On 2026-06-13, Paul Rubin wrote: > Jon Ribbens writes: >> with open('/proc/meminfo') as meminfo: >> info = { >> entry[0][:-1]: int(entry[1]) >> for line in meminfo >> if (entry := line.split()) >> } > > with open('/proc/meminfo') as meminfo: > info

Re: get_used_memory

2026-06-13 Thread Jon Ribbens via Python-list
On 2026-06-13, Paul Rubin wrote: > Jon Ribbens writes: > >> Oh, and doesn't have ints as the dictionary values, which is rather >> more fatal to the use-case. > >> print("Used memory: %d Kb" % (info["MemTotal"] - info["MemFree"] - >> info["Buffers"] - info["Cached"] + info["SwapTotal"] - info["S

Re: get_used_memory

2026-06-13 Thread Jon Ribbens via Python-list
On 2026-06-13, Jon Ribbens wrote: > On 2026-06-13, Paul Rubin wrote: >> Jon Ribbens writes: >>> with open('/proc/meminfo') as meminfo: >>> info = { >>> entry[0][:-1]: int(entry[1]) >>> for line in meminfo >>> if (entry := line.split()) >>> } >> >> with

Re: get_used_memory

2026-06-13 Thread Jon Ribbens via Python-list
On 2026-06-13, Paul Rubin wrote: > Jon Ribbens 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 neste