Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread dn via Python-list
On 31/03/2021 19.24, Loris Bennett wrote: > dn writes: > >> On 31/03/2021 01.22, Loris Bennett wrote: >>> Jon Ribbens writes: On 2021-03-30, Loris Bennett wrote: > If I have dict of dicts, say > > dod = { > "alice": > { > "lang": "python", >>

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Loris Bennett
dn writes: > On 31/03/2021 01.22, Loris Bennett wrote: >> Jon Ribbens writes: >>> On 2021-03-30, Loris Bennett wrote: If I have dict of dicts, say dod = { "alice": { "lang": "python", "level": "expert" },

Re: New Python curses book

2021-03-30 Thread jak
Il 30/03/2021 21:05, Brian Oney ha scritto: Congratulations! Indeed, I was wondering for a moment if this was a guide to al dente spaghetti code. With each curse being a funny way to mess with the colleagues performing the code review ;) Indeed, I was wondering for a moment if this was a gui

Re: memory consumption

2021-03-30 Thread Inada Naoki
On Mon, Mar 29, 2021 at 7:16 PM Alexey wrote: > > Problem. Before executing, my interpreter process weighs ~100Mb, after first > run memory increases up to 500Mb > and after second run it weighs 1Gb. If I will continue to run this class, > memory wont increase, so I think > it's not a memory lea

Re: memory consumption

2021-03-30 Thread Cameron Simpson
Since everyone is talking about vague OS memory use and not at all about working set size of Python objects, let me ... On 29Mar2021 03:12, Alexey wrote: >I'm experiencing problems with memory consumption. > >I have a class which is doing ETL job. What`s happening inside: > - fetching existing o

Re: New Python curses book

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 20:05, Brian Oney via Python-list wrote: > Congratulations! > > Indeed, I was wondering for a moment if this was a guide to al dente > spaghetti code. With each curse being a funny way to mess with the colleagues > performing the code review ;) You may jest but I originally titled

Re: Ann: New Python curses book

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 19:52, Grant Edwards wrote: > It is. I just bought the kindle version on the US site, and it renders > fine in the cloud reader. It would be cool if you could cut/paste code > examples from the book into IDLE or a text editor, but I've never been > able to get the cloud reader to all

Re: memory consumption

2021-03-30 Thread Dan Stromberg
On Tue, Mar 30, 2021 at 1:25 AM Alexey wrote: > > I'm sorry. I didn't understand your question right. If I have 4 workers, > they require 4Gb > in idle state and some extra memory when they execute other tasks. If I > increase workers > count up to 16, they`ll eat all the memory I have (16GB) on

Re: memory consumption

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 16:50, Chris Angelico wrote: >> A 1GB process on modern computers is hardly a big problem? >> Most machines have 4G and many have 16G or even 32G >> nowadays. >> > > Desktop systems maybe, but if you rent yourself a worker box, it might > not have anything like that much. Especially

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread dn via Python-list
On 31/03/2021 01.22, Loris Bennett wrote: > Jon Ribbens writes: >> On 2021-03-30, Loris Bennett wrote: >>> If I have dict of dicts, say >>> >>> dod = { >>> "alice": >>> { >>> "lang": "python", >>> "level": "expert" >>> }, >>> "bob": >>> { >>>

Re: New Python curses book

2021-03-30 Thread Brian Oney via Python-list
Congratulations! Indeed, I was wondering for a moment if this was a guide to al dente spaghetti code. With each curse being a funny way to mess with the colleagues performing the code review ;) Or a list of funny Monty Python curses? Or a set of programming problems that are cursed? On Marc

Re: Ann: New Python curses book

2021-03-30 Thread Grant Edwards
On 2021-03-30, Alan Gauld via Python-list wrote: > On 30/03/2021 17:14, Grant Edwards wrote: > >> Is the kindle format readable via a web browser pointed at >> read.amazon.com (AKA "Kindle Cloud Reader)? > > It seems to be, I downloaded the free sample and could > read the first 2 chapters on the

RE: Ann: New Python curses book

2021-03-30 Thread Avi Gross via Python-list
Bill, I went afterward to the US Amazon Site and the prices are in dollars and ordered the paperback for $5.99, no shipping cost with PRIME but I ordered, paradoxically, an assortment of mice alongside so it would have been free anyway. The Kindle version is $1.49 https://www.amazon.com/Progra

Re: Ann: New Python curses book

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 17:14, Grant Edwards wrote: > Is the kindle format readable via a web browser pointed at > read.amazon.com (AKA "Kindle Cloud Reader)? It seems to be, I downloaded the free sample and could read the first 2 chapters on the web reader. -- Alan G Author of the Learn to Program web s

Re: Ann: New Python curses book

2021-03-30 Thread Grant Edwards
On 2021-03-30, William Ray Wing via Python-list wrote: > I’ve ordered the book (physical volume). It will fulfill a need I’ve > had for some time. Unfortunately, it is only available in the UK > store, so the shipping cost by far outweighs the book’s cost. Hope > for other’s sake, it migrates t

Re: Ann: New Python curses book

2021-03-30 Thread William Ray Wing via Python-list
I’ve ordered the book (physical volume). It will fulfill a need I’ve had for some time. Unfortunately, it is only available in the UK store, so the shipping cost by far outweighs the book’s cost. Hope for other’s sake, it migrates to the other Amazon stores fairly quickly. Thanks, Bill > On

Re: Ann: New Python curses book

2021-03-30 Thread Grant Edwards
On 2021-03-30, Alan Gauld via Python-list wrote: > I've just published, in Kindle and paperback formats, > my book on "Programming curses with Python". > > https://www.amazon.co.uk/dp/B091B85B77/ > > (It should be available in most other Amazon stores too) Cool. Is the kindle format readable vi

Re: New Python curses book

2021-03-30 Thread Chris Angelico
On Wed, Mar 31, 2021 at 3:21 AM Avi Gross via Python-list wrote: > > Congratulations, Alan, on the book. > > I continue to wonder if people will buy the book for the wrong reason or ban > it thinking you created an AI snake that creates and spews new CURSES never > heard before. A reasonable misu

RE: New Python curses book

2021-03-30 Thread Avi Gross via Python-list
Congratulations, Alan, on the book. I continue to wonder if people will buy the book for the wrong reason or ban it thinking you created an AI snake that creates and spews new CURSES never heard before. The good news is that for those interested you can click on the book image and see the preview

Re: memory consumption

2021-03-30 Thread Chris Angelico
On Wed, Mar 31, 2021 at 2:44 AM Alan Gauld via Python-list wrote: > > On 29/03/2021 11:12, Alexey wrote: > > Hello everyone! > > I'm experiencing problems with memory consumption. > > > > The first thing you really need to tell us is which > OS you are using? Memory management varies wildly > depe

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Marco Ippolito
> > For completeness, from 3.5 onwards, you can also do the following: > > [{'name': n, **d} for n, d in dod.items()] > Reading through these, personally I like this one best. I'm curious what > about it was enabled in 3.5? Was **kwarg expansion inside a dict literal not > possible before then? Any

Re: memory consumption

2021-03-30 Thread Marco Ippolito
Have you tried to identify where in your code the surprising memory allocations are made? You could "bisect search" by adding breakpoints: https://docs.python.org/3/library/functions.html#breakpoint At which point does the problem start manifesting itself? -- https://mail.python.org/mailman/lis

Ann: New Python curses book

2021-03-30 Thread Alan Gauld via Python-list
I've just published, in Kindle and paperback formats, my book on "Programming curses with Python". https://www.amazon.co.uk/dp/B091B85B77/ (It should be available in most other Amazon stores too) It is a complete rewrite of the Linux Documentation Project's HowTo for the C ncurses library. It ha

Re: memory consumption

2021-03-30 Thread Alan Gauld via Python-list
On 29/03/2021 11:12, Alexey wrote: > Hello everyone! > I'm experiencing problems with memory consumption. > The first thing you really need to tell us is which OS you are using? Memory management varies wildly depending on OS. Even different flavours of *nix do it differently. However, most do i

Re: Code Formatter Questions

2021-03-30 Thread Terry Reedy
On 3/29/2021 4:18 PM, dn via Python-list wrote: Very good point: I'd much rather you spent time helping me with a design/coding problem, helping debug, and/or reviewing/improving my code (and I for you); than we had not time left-over after spending many hours and much mental energy arguing abou

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Chris Angelico
On Wed, Mar 31, 2021 at 1:56 AM Travis Griggs wrote: > > > > On Mar 30, 2021, at 12:11, Stestagg wrote: > > > > For completeness, from 3.5 onwards, you can also do the following: > > > > [{'name': n, **d} for n, d in dod.items()] > > > > Reading through these, personally I like this one best. I'm

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Travis Griggs
> On Mar 30, 2021, at 12:11, Stestagg wrote: > > For completeness, from 3.5 onwards, you can also do the following: > > [{'name': n, **d} for n, d in dod.items()] > Reading through these, personally I like this one best. I'm curious what about it was enabled in 3.5? Was **kwarg expansion in

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Loris Bennett
Jon Ribbens writes: > On 2021-03-30, Loris Bennett wrote: >> If I have dict of dicts, say >> >> dod = { >> "alice": >> { >> "lang": "python", >> "level": "expert" >> }, >> "bob": >> { >> "lang": "perl", >> "level": "noob" >>

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Chris Angelico
On Tue, Mar 30, 2021 at 11:21 PM Jon Ribbens via Python-list wrote: > > On 2021-03-30, Chris Angelico wrote: > > On Tue, Mar 30, 2021 at 11:01 PM Jon Ribbens via Python-list > > wrote: > >> > >> On 2021-03-30, Chris Angelico wrote: > >> > I dunno about "canonical", but here's how I'd do it: > >>

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Jon Ribbens via Python-list
On 2021-03-30, Chris Angelico wrote: > On Tue, Mar 30, 2021 at 11:01 PM Jon Ribbens via Python-list > wrote: >> >> On 2021-03-30, Chris Angelico wrote: >> > I dunno about "canonical", but here's how I'd do it: >> > >> > lod = [info | {"name": name} for name, info in dod.items()] >> > >> > You cou

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Stestagg
For completeness, from 3.5 onwards, you can also do the following: [{'name': n, **d} for n, d in dod.items()] On Tue, Mar 30, 2021 at 1:06 PM Chris Angelico wrote: > On Tue, Mar 30, 2021 at 11:01 PM Jon Ribbens via Python-list > wrote: > > > > On 2021-03-30, Chris Angelico wrote: > > > I dunn

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Chris Angelico
On Tue, Mar 30, 2021 at 11:01 PM Jon Ribbens via Python-list wrote: > > On 2021-03-30, Chris Angelico wrote: > > I dunno about "canonical", but here's how I'd do it: > > > > lod = [info | {"name": name} for name, info in dod.items()] > > > > You could use {"name":name}|info instead if you prefer

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Jon Ribbens via Python-list
On 2021-03-30, Chris Angelico wrote: > I dunno about "canonical", but here's how I'd do it: > > lod = [info | {"name": name} for name, info in dod.items()] > > You could use {"name":name}|info instead if you prefer to have the > name show up first in the dictionary. It's probably worth noting thi

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Jon Ribbens via Python-list
On 2021-03-30, Loris Bennett wrote: > If I have dict of dicts, say > > dod = { > "alice": > { > "lang": "python", > "level": "expert" > }, > "bob": > { > "lang": "perl", > "level": "noob" > } > } > > is there a canonic

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Chris Angelico
On Tue, Mar 30, 2021 at 10:41 PM Loris Bennett wrote: > > Hi, > > If I have dict of dicts, say > > dod = { > "alice": > { > "lang": "python", > "level": "expert" > }, > "bob": > { > "lang": "perl", > "level": "noob" > }

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Stestagg
I'm not certain this is the clearest possible code pattern to use, but depending on the structure of your larger code, it's possible to do this, and the compactness may help with understandability (that's a judgement call!): [dict(d, name=n) for n, d in dod.items()] On Tue, Mar 30, 2021 at 12:42

Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread Loris Bennett
Hi, If I have dict of dicts, say dod = { "alice": { "lang": "python", "level": "expert" }, "bob": { "lang": "perl", "level": "noob" } } is there a canonical, or more pythonic, way of converting the outer key to a val

Re: memory consumption

2021-03-30 Thread Stestagg
> I'm sorry. I didn't understand your question right. If I have 4 workers, > they require 4Gb > in idle state and some extra memory when they execute other tasks. If I > increase workers > count up to 16, they`ll eat all the memory I have (16GB) on my machine and > will crash as soon > as system ge

Re: memory consumption

2021-03-30 Thread Alexey
понедельник, 29 марта 2021 г. в 19:56:52 UTC+3, Stestagg: > > > 2. Can you try a test with 16 or 32 active workers (i.e. number of > > > workers=2x available memory in GB), do they all still end up with 1gb > > > usage? or do you get any other memory-related issues running this? > > Yes. They wi

Re: memory consumption

2021-03-30 Thread Alexey
понедельник, 29 марта 2021 г. в 19:37:03 UTC+3, Dieter Maurer: > Alexey wrote at 2021-3-29 06:26 -0700: > >понедельник, 29 марта 2021 г. в 15:57:43 UTC+3, Julio Oña: > >> It looks like the problem is on celery. > >> The mentioned issue is still open, so not sure if it was corrected. > >> > >>