Re: Retrieving non-/etc/passwd users with Python 3?

2021-03-31 Thread Loris Bennett
Christian Heimes writes: > On 31/03/2021 14.45, Loris Bennett wrote: >> Chris Angelico writes: >> >>> On Wed, Mar 31, 2021 at 11:21 PM Loris Bennett >>> wrote: Hi, I want to get a list of users on a Linux system using Python 3.6. All the users I am interested in are j

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

2021-03-31 Thread Greg Ewing
On 31/03/21 7:37 pm, dn wrote: Python offers mutable (can be changed) and immutable (can't) objects (remember: 'everything is an object'): https://docs.python.org/3/reference/datamodel.html?highlight=mutable%20data While that's true, it's actually irrelevant to this situation. $ a = "bob"

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-03-31 Thread dn via Python-list
On 01/04/2021 13.54, Chris Angelico wrote: > On Thu, Apr 1, 2021 at 11:39 AM dn via Python-list > wrote: >> >> On 01/04/2021 12.14, Chris Angelico wrote: >>> I think this code makes some sort of argument in the debate about >>> whether Python has too much flexibility or if it's the best >>> metapr

Re: memory consumption

2021-03-31 Thread Rob Cliffe via Python-list
On 31/03/2021 09:35, Alexey wrote: среда, 31 марта 2021 г. в 01:20:06 UTC+3, Dan Stromberg: What if you increase the machine's (operating system's) swap space? Does that take care of the problem in practice? I can`t do that because it will affect other containers running on this host. In my

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-03-31 Thread Chris Angelico
On Thu, Apr 1, 2021 at 11:39 AM dn via Python-list wrote: > > On 01/04/2021 12.14, Chris Angelico wrote: > > I think this code makes some sort of argument in the debate about > > whether Python has too much flexibility or if it's the best > > metaprogramming toolset in the world. I'm not sure whic

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-03-31 Thread dn via Python-list
On 01/04/2021 12.14, Chris Angelico wrote: > I think this code makes some sort of argument in the debate about > whether Python has too much flexibility or if it's the best > metaprogramming toolset in the world. I'm not sure which side of the > debate it falls on, though. > > class Building: >

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-03-31 Thread Ethan Furman
On 3/31/21 4:14 PM, Chris Angelico wrote: I think this code makes some sort of argument in the debate about whether Python has too much flexibility or if it's the best metaprogramming toolset in the world. I'm not sure which side of the debate it falls on, though. Well, `__init_subclass__` is t

Horrible abuse of __init_subclass__, or elegant hack?

2021-03-31 Thread Chris Angelico
I think this code makes some sort of argument in the debate about whether Python has too much flexibility or if it's the best metaprogramming toolset in the world. I'm not sure which side of the debate it falls on, though. class Building: resource = None @classmethod def __init_subclas

Re: Unable to find 'edit with ide' option in the Context menu

2021-03-31 Thread Terry Reedy
On 3/31/2021 2:11 AM, Arjav Jain wrote: I am using the lastest version of python recently. But I am facing a problem with the python files, When I am right clicking any python file there is no option for `Edit with idle'. I have repaired the python installation too, but this doesn

Re: memory consumption

2021-03-31 Thread Alexey
среда, 31 марта 2021 г. в 18:17:46 UTC+3, Dieter Maurer: > Alexey wrote at 2021-3-31 02:43 -0700: > >среда, 31 марта 2021 г. в 06:54:52 UTC+3, Inada Naoki: > > ... > >> You can get some hints from sys._debugmallocstats(). It prints > >> obmalloc (allocator for small objects) stats to stderr. > >

Re: memory consumption

2021-03-31 Thread Dieter Maurer
Alexey wrote at 2021-3-31 02:43 -0700: >среда, 31 марта 2021 г. в 06:54:52 UTC+3, Inada Naoki: > ... >> You can get some hints from sys._debugmallocstats(). It prints >> obmalloc (allocator for small objects) stats to stderr. >> Try printing stats before and after 1st run, and after 2nd run. And >>

Source code link was: Re: Ann: New Python curses book

2021-03-31 Thread Alan Gauld via Python-list
On 31/03/2021 00:09, Alan Gauld via Python-list wrote: > Watch this space. Hopefully tomorrow. The source code is now available in a zip file at: http://www.alan-g.me.uk/hills/PythonCursesCode.zip Or via a link on the programming section of my home page http://www.alan-g.me.uk/ It is licensed

Unable to find 'edit with ide' option in the Context menu

2021-03-31 Thread Arjav Jain
I am using the lastest version of python recently. But I am facing a problem with the python files, When I am right clicking any python file there is no option for `Edit with idle'. I have repaired the python installation too, but this doesn't solves my problem, please help! Sent f

Re: Retrieving non-/etc/passwd users with Python 3?

2021-03-31 Thread Christian Heimes
On 31/03/2021 14.45, Loris Bennett wrote: > Chris Angelico writes: > >> On Wed, Mar 31, 2021 at 11:21 PM Loris Bennett >> wrote: >>> >>> Hi, >>> >>> I want to get a list of users on a Linux system using Python 3.6. All >>> the users I am interested in are just available via LDAP and are not in

Re: Retrieving non-/etc/passwd users with Python 3?

2021-03-31 Thread Loris Bennett
Chris Angelico writes: > On Wed, Mar 31, 2021 at 11:21 PM Loris Bennett > wrote: >> >> Hi, >> >> I want to get a list of users on a Linux system using Python 3.6. All >> the users I am interested in are just available via LDAP and are not in >> /etc/passwd. Thus, in a bash shell I can use 'get

Re: Retrieving non-/etc/passwd users with Python 3?

2021-03-31 Thread Chris Angelico
On Wed, Mar 31, 2021 at 11:21 PM Loris Bennett wrote: > > Hi, > > I want to get a list of users on a Linux system using Python 3.6. All > the users I am interested in are just available via LDAP and are not in > /etc/passwd. Thus, in a bash shell I can use 'getent' to display them. > > When I tr

Retrieving non-/etc/passwd users with Python 3?

2021-03-31 Thread Loris Bennett
Hi, I want to get a list of users on a Linux system using Python 3.6. All the users I am interested in are just available via LDAP and are not in /etc/passwd. Thus, in a bash shell I can use 'getent' to display them. When I try to install the PyPi package getent I get the error File "/

Re: memory consumption

2021-03-31 Thread Alexey
среда, 31 марта 2021 г. в 14:16:30 UTC+3, Inada Naoki: > > ** Before first run: > > # arenas allocated total = 776 > > # arenas reclaimed = 542 > > # arenas highwater mark = 234 > > # arenas allocated current = 234 > > 234 arenas * 262144 bytes/arena = 61,341,696 > > ** After fi

Re: memory consumption

2021-03-31 Thread Inada Naoki
> ** Before first run: > # arenas allocated total = 776 > # arenas reclaimed = 542 > # arenas highwater mark= 234 > # arenas allocated current = 234 > 234 arenas * 262144 bytes/

Re: memory consumption

2021-03-31 Thread Alexey
среда, 31 марта 2021 г. в 11:52:43 UTC+3, Marco Ippolito: > > > At which point does the problem start manifesting itself? > > The problem spot is my cache(dict). I simplified my code to just load > > all the objects to this dict and then clear it. > What's the memory utilisation just _before_ per

Re: memory consumption

2021-03-31 Thread Alexey
среда, 31 марта 2021 г. в 06:54:52 UTC+3, Inada Naoki: > First of all, I recommend upgrading your Python. Python 3.6 is a bit old. I was thinking about that. > As you saying, Python can not return the memory to OS until the whole > arena become unused. > If your task releases all objects alloc

Re: memory consumption

2021-03-31 Thread Alexey
среда, 31 марта 2021 г. в 05:45:27 UTC+3, cameron...@gmail.com: > 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

Re: memory consumption

2021-03-31 Thread Marco Ippolito
> > At which point does the problem start manifesting itself? > The problem spot is my cache(dict). I simplified my code to just load > all the objects to this dict and then clear it. What's the memory utilisation just _before_ performing this load? I am assuming it's much less than this 1 GB you

Re: memory consumption

2021-03-31 Thread Alexey
среда, 31 марта 2021 г. в 01:20:06 UTC+3, 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 > > inc

Re: memory consumption

2021-03-31 Thread Alexey
вторник, 30 марта 2021 г. в 18:43:54 UTC+3, Alan Gauld: > On 29/03/2021 11:12, Alexey wrote: > 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. I'm using Ubuntu(5.8.

Re: memory consumption

2021-03-31 Thread Alexey
вторник, 30 марта 2021 г. в 18:43:51 UTC+3, Marco Ippolito: > Have you tried to identify where in your code the surprising memory > allocations > are made? Yes. > You could "bisect search" by adding breakpoints: > > https://docs.python.org/3/library/functions.html#breakpoint > > At which po