Re: Could frozendict or frozenmap be of some use for PEP 683 (Immortal objects)?

2022-03-10 Thread Marco Sulla
On Wed, 9 Mar 2022 at 23:28, Martin Di Paola  wrote:
> Think in the immutable strings (str). What would happen with a program
> that does heavy parsing? I imagine that it will generate thousands of
> little strings. If those are immortal, the program will fill its memory
> very quickly as the GC will not reclaim their memory.

Well, as far as I know immortality was also suggested for interned
strings. If I understood well, the problem with "normal" strings is
that they are not really immutable in CPython. They have cache etc.
Also frozendict caches hash, but that cache can be easily removed.
-- 
https://mail.python.org/mailman/listinfo/python-list


Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Marco Sulla
On Thu, 10 Mar 2022 at 04:50, Michael Torrie  wrote:
>
> On 3/9/22 13:05, Marco Sulla wrote:
> > So my laziness pays. I use only LTS distros, and I update only when
> > there are security updates.
> > PS: any suggestions for a new LTS distro? My Lubuntu is reaching its
> > end-of-life. I prefer lightweight debian-like distros.
>
> Maybe Debian itself?

I tried Debian on a VM, but I found it too much basical. A little
example: it does not have the shortcut ctrl+alt+t to open a terminal
that Ubuntu has. I'm quite sure it's simple to add, but I'm starting
to be old and lazy...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Jack Dangler



On 3/10/22 08:03, Marco Sulla wrote:

On Thu, 10 Mar 2022 at 04:50, Michael Torrie  wrote:

On 3/9/22 13:05, Marco Sulla wrote:

So my laziness pays. I use only LTS distros, and I update only when
there are security updates.
PS: any suggestions for a new LTS distro? My Lubuntu is reaching its
end-of-life. I prefer lightweight debian-like distros.

Maybe Debian itself?

I tried Debian on a VM, but I found it too much basical. A little
example: it does not have the shortcut ctrl+alt+t to open a terminal
that Ubuntu has. I'm quite sure it's simple to add, but I'm starting
to be old and lazy...
or why not get a cloud desktop running whatever distro you want and you 
don't have to do anything

--
https://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Chris Angelico
On Fri, 11 Mar 2022 at 00:05, Marco Sulla  wrote:
>
> On Thu, 10 Mar 2022 at 04:50, Michael Torrie  wrote:
> >
> > On 3/9/22 13:05, Marco Sulla wrote:
> > > So my laziness pays. I use only LTS distros, and I update only when
> > > there are security updates.
> > > PS: any suggestions for a new LTS distro? My Lubuntu is reaching its
> > > end-of-life. I prefer lightweight debian-like distros.
> >
> > Maybe Debian itself?
>
> I tried Debian on a VM, but I found it too much basical. A little
> example: it does not have the shortcut ctrl+alt+t to open a terminal
> that Ubuntu has. I'm quite sure it's simple to add, but I'm starting
> to be old and lazy...

Very easy. I use Debian with Xfce, and it's an easy thing to add
shortcuts - even dynamically (I have Alt+D to dictate notes, but only
while I'm playing Counter-Strike competitively).

Debian + Xfce is a combo that's served me very well for years now. I
didn't much like the latest Adwaita colour scheme, but a small tweak
later, it's fine again.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


How to test input via subprocess.Popen with data from file

2022-03-10 Thread Loris Bennett
Hi,

I have a command which produces output like the
following:

  Job ID: 9431211
  Cluster: curta
  User/Group: build/staff
  State: COMPLETED (exit code 0)
  Nodes: 1
  Cores per node: 8
  CPU Utilized: 01:30:53
  CPU Efficiency: 83.63% of 01:48:40 core-walltime
  Job Wall-clock time: 00:13:35
  Memory Utilized: 6.45 GB
  Memory Efficiency: 80.68% of 8.00 GB

I want to parse this and am using subprocess.Popen and accessing the
contents via Popen.stdout.  However, for testing purposes I want to save
various possible outputs of the command as text files and use those as
inputs. 

What format should I use to pass data to the actual parsing function?

I could in both production and test convert the entire input to a string
and pass the string to the parsing method.

However, I could use something like

   test_input_01 = subprocess.Popen(
["cat test_input_01.txt"],
stdout=subprocess.PIPE,
)
  
for the test input and then pass a Popen object to the parsing function.

Any comments on these alternative or suggestions for doing something
completely different?

Cheers,

Loris
 
-- 
This signature is currently under construction.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Loris Bennett
Marco Sulla  writes:

> On Thu, 10 Mar 2022 at 04:50, Michael Torrie  wrote:
>>
>> On 3/9/22 13:05, Marco Sulla wrote:
>> > So my laziness pays. I use only LTS distros, and I update only when
>> > there are security updates.
>> > PS: any suggestions for a new LTS distro? My Lubuntu is reaching its
>> > end-of-life. I prefer lightweight debian-like distros.
>>
>> Maybe Debian itself?
>
> I tried Debian on a VM, but I found it too much basical. A little
> example: it does not have the shortcut ctrl+alt+t to open a terminal
> that Ubuntu has. I'm quite sure it's simple to add, but I'm starting
> to be old and lazy...

The shortcuts are properties of the desktop environment.  You could just
install LXDE/LXQt on Debian if that's what you're used to from Lubuntu.
Of course, if you're too old and lazy to set up a shortcut, you might
also be too old and lazy to install a different desktop environment ;-)

Cheers,

Loris

-- 
This signature is currently under construction.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Michael Torrie
On 3/10/22 06:03, Marco Sulla wrote:
> I tried Debian on a VM, but I found it too much basical. A little
> example: it does not have the shortcut ctrl+alt+t to open a terminal
> that Ubuntu has. I'm quite sure it's simple to add, but I'm starting
> to be old and lazy...

Debian has the same desktop environments available for install as the
rest of the distros.  Gnome 3, Mate, LXDE, XFCE, KDE, etc.  Whatever
works for you on Ubuntu should work on Debian.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to test input via subprocess.Popen with data from file

2022-03-10 Thread Dieter Maurer
Loris Bennett wrote at 2022-3-10 13:16 +0100:
>I have a command which produces output like the
>following:
>
>  Job ID: 9431211
>  Cluster: curta
>  User/Group: build/staff
>  State: COMPLETED (exit code 0)
>  Nodes: 1
>  Cores per node: 8
>  CPU Utilized: 01:30:53
>  CPU Efficiency: 83.63% of 01:48:40 core-walltime
>  Job Wall-clock time: 00:13:35
>  Memory Utilized: 6.45 GB
>  Memory Efficiency: 80.68% of 8.00 GB
>
>I want to parse this and am using subprocess.Popen and accessing the
>contents via Popen.stdout.  However, for testing purposes I want to save
>various possible outputs of the command as text files and use those as
>inputs.

What do you want to test? the parsing? the "popen" interaction?
You can separately test both tasks (I, at your place, would do this).

For the parsing test, it is not relevant that the actual text
comes from an external process. You can directly read it from a file
or have it in your text.

In my view, you do not need a test for the `Popen` interaction:
if it works once, it will work always.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Typing on child class' methods of a Generic base class

2022-03-10 Thread Dieter Maurer
Nicolas Haller wrote at 2022-3-9 10:53 -0500:
> ...
>The documentation about "user-defined generic types"[1] says that I can
>fix some types on a child class (class MyDict(Mapping[str, T]):) but
>doesn't say much about the signature of the methods I need to
>implement/override on that child class.

I have the fealing that this is a case of (generic type) "specialization".
In this setup, `Mapping` would be a generic type with two type
variables `K` (the key type) and `V` (the value type).
The signatures of its methods would use those type variables.
In your example, you specialize the key type to `str` (and
leave the value type generic). The signatures of the methods
would automatically follow this specialization -- without the need
to do anything.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Marco Sulla
On Thu, 10 Mar 2022 at 14:13, Jack Dangler  wrote:
> or why not get a cloud desktop running whatever distro you want and you
> don't have to do anything

Three reasons: privacy, speed, price. Not in this order.

On Thu, 10 Mar 2022 at 15:20, Chris Angelico  wrote:
> Very easy. I use Debian with Xfce, and it's an easy thing to add
> shortcuts - even dynamically

I used Xubuntu for a long time. I like Xfce.



On Thu, 10 Mar 2022 at 16:35, Loris Bennett  wrote:
> The shortcuts are properties of the desktop environment.  You could just
> install LXDE/LXQt on Debian if that's what you're used to from Lubuntu.

I tried LXQt on my desktop. Very disappointed. The OS Update interface
is just an "alert". LXDE unluckily is no longer developed.

> Of course, if you're too old and lazy to set up a shortcut, you might
> also be too old and lazy to install a different desktop environment ;-)

Okay, I'm lazy for boring things :D

PS: Is it just my impression or is there a plebiscite for Debian?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Michael Torrie
On 3/10/22 12:42, Marco Sulla wrote:
> PS: Is it just my impression or is there a plebiscite for Debian?

A vote?  No I don't think so.  Not sure what you mean.  The reason we're
all suggesting Debian is because you specifically said you want a LTS
Debian-like distro. Can't get any more Debian-like than Debian!  Debian
with XFCE should give you the same experience as Xubuntu, and is always
supported for a very long time.

Personally I run Fedora with Mate or KDE and I upgrade the OS every
12-18 months, usually skipping a version or two.  I did consider Centos
8 stream, but I needed something a little newer for various reasons.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Cousin Stanley
Marco Sulla wrote:

>>
>> Maybe Debian itself?
> 
> I tried Debian on a VM, but I found it too much basical. A little
> example: it does not have the shortcut ctrl+alt+t to open a terminal
> that Ubuntu has. I'm quite sure it's simple to add, but I'm starting
> to be old and lazy...
> 

  I use the current stable release of Debian 11.2 Bullseye
  with the lxqt desktop environment  

[Ctrl]-[Alt]-[T] will open a new qterminal window.


  The following will display a list of lxqt packages
  that are in the repository and available to install 

apt-cache search lxqt | grep ^lxqt

  
-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Chris Angelico
On Fri, 11 Mar 2022 at 09:51, Cousin Stanley  wrote:
>
> Marco Sulla wrote:
>
> >>
> >> Maybe Debian itself?
> >
> > I tried Debian on a VM, but I found it too much basical. A little
> > example: it does not have the shortcut ctrl+alt+t to open a terminal
> > that Ubuntu has. I'm quite sure it's simple to add, but I'm starting
> > to be old and lazy...
> >
>
>   I use the current stable release of Debian 11.2 Bullseye
>   with the lxqt desktop environment 
>
> [Ctrl]-[Alt]-[T] will open a new qterminal window.
>
>
>   The following will display a list of lxqt packages
>   that are in the repository and available to install 
>
> apt-cache search lxqt | grep ^lxqt
>
Much faster:

apt-cache pkgnames lxqt

(apt-cache search will look for "lxqt" in descriptions too, hence the
need to filter those out - apt-cache pkgnames is used by tab
completion)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Dan Stromberg
On Thu, Mar 10, 2022 at 5:04 AM Marco Sulla 
wrote:

> On Thu, 10 Mar 2022 at 04:50, Michael Torrie  wrote:
> >
> > On 3/9/22 13:05, Marco Sulla wrote:
> > > So my laziness pays. I use only LTS distros, and I update only when
> > > there are security updates.
> > > PS: any suggestions for a new LTS distro? My Lubuntu is reaching its
> > > end-of-life. I prefer lightweight debian-like distros.
> >
> > Maybe Debian itself?
>
> I tried Debian on a VM, but I found it too much basical. A little
> example: it does not have the shortcut ctrl+alt+t to open a terminal
> that Ubuntu has. I'm quite sure it's simple to add, but I'm starting
> to be old and lazy...
>
That's an attribute of your desktop environment, not the Linux distribution.

EG: I'm using Debian with Cinnamon, which does support ctrl-alt-t.

Some folks say the desktop environment matters more than the distribution,
when choosing what OS to install.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Chris Angelico
On Fri, 11 Mar 2022 at 16:39, Dan Stromberg  wrote:
> Some folks say the desktop environment matters more than the distribution,
> when choosing what OS to install.

Matters more to the choice? Impossible to say.

Matters more to the UI? Without a doubt.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to test input via subprocess.Popen with data from file

2022-03-10 Thread Loris Bennett
Dieter Maurer  writes:

> Loris Bennett wrote at 2022-3-10 13:16 +0100:
>>I have a command which produces output like the
>>following:
>>
>>  Job ID: 9431211
>>  Cluster: curta
>>  User/Group: build/staff
>>  State: COMPLETED (exit code 0)
>>  Nodes: 1
>>  Cores per node: 8
>>  CPU Utilized: 01:30:53
>>  CPU Efficiency: 83.63% of 01:48:40 core-walltime
>>  Job Wall-clock time: 00:13:35
>>  Memory Utilized: 6.45 GB
>>  Memory Efficiency: 80.68% of 8.00 GB
>>
>>I want to parse this and am using subprocess.Popen and accessing the
>>contents via Popen.stdout.  However, for testing purposes I want to save
>>various possible outputs of the command as text files and use those as
>>inputs.
>
> What do you want to test? the parsing? the "popen" interaction?
> You can separately test both tasks (I, at your place, would do this).

I just want to test the parsing.

> For the parsing test, it is not relevant that the actual text
> comes from an external process. You can directly read it from a file
> or have it in your text.

As mentioned in the original post, for the tests I indeed want to read
the input from files.

> In my view, you do not need a test for the `Popen` interaction:
> if it works once, it will work always.

Sorry if I was unclear but my question is:

Given that the return value from Popen is a Popen object and given that
the return value from reading a file is a single string or maybe a list
of strings, what should the common format for the argument which is
passed to the actual parsing function be?

Cheers,

Loris
-- 
This signature is currently under construction.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to test input via subprocess.Popen with data from file

2022-03-10 Thread Dieter Maurer
Loris Bennett wrote at 2022-3-11 07:40 +0100:
> ... I want to test the parsing ...
>Sorry if I was unclear but my question is:
>
>Given that the return value from Popen is a Popen object and given that
>the return value from reading a file is a single string or maybe a list
>of strings, what should the common format for the argument which is
>passed to the actual parsing function be?

What methods (of its input argument) does the parsing use?
If it uses `Popen` methods, then you pass a `POpen` object;
if it uses only (typical) file methods, then you pass a file object;
if it assumes its input to be a (line) interator, you pass
a (line) iterator (such as a "file" object).

I would design the parsing that it makes as few assumptions
about its input as possible -- to ease testing
and increase the chance for reuse.

That said, I would not design it to work with `Popen` objects
but likely to have a line iterator as input.
-- 
https://mail.python.org/mailman/listinfo/python-list