Re: Anonymous email users

2024-06-17 Thread Roel Schroeven via Python-list
AVI GROSS via Python-list schreef op 17/06/2024 om 17:03: I simply am thinking that people who do not allow me to easily reply to them directly, should be ignored by me and not get my cooperation that way. FWIW, personally I (mostly) don't see the point of replying to people personally. To me a

Re: pip and venvs on Debian

2024-05-21 Thread Roel Schroeven via Python-list
Op 20/05/2024 om 23:48 schreef Akkana Peck via Python-list: Every so often I need to regenerate it (like when Debian updates the system Python version) but that's easy to do: I don't try to duplicate what's installed there, I just delete the old venv, create a new one and then pip install

Re: Terminal Emulator (Posting On Python-List Prohibited)

2024-05-19 Thread Roel Schroeven via Python-list
Skip Montanaro via Python-list schreef op 20/05/2024 om 0:08: Modern debian (ubuntu) and fedora block users installing using pip. > Even if you're telling it to install in ~/.local? I could see not allowing to run it as root. I assumed pip install --user would work, but no. I tried it (on

Re: Configuring an object via a dictionary

2024-03-20 Thread Roel Schroeven via Python-list
Op 19/03/2024 om 0:44 schreef Gilmeh Serda via Python-list: On Mon, 18 Mar 2024 10:09:27 +1300, dn wrote: > YMMV! > NB your corporate Style Guide may prefer 'the happy path'... If you only want to check for None, this works too: >>> name = None >>> dafault_value = "default" >>> name or

Re: Configuring an object via a dictionary

2024-03-16 Thread Roel Schroeven via Python-list
Barry via Python-list schreef op 16/03/2024 om 9:15: > On 15 Mar 2024, at 19:51, Thomas Passin via Python-list wrote: > > I've always like writing using the "or" form and have never gotten bit I, on the other hand, had to fix a production problem that using “or” introducted. I avoid this

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Roel Schroeven via Python-list
Grant Edwards via Python-list schreef op 6/03/2024 om 18:59: On 2024-03-06, Roel Schroeven via Python-list wrote: > Op 6/03/2024 om 17:40 schreef Jacob Kruger via Python-list: >> >>> from scoping2 import * > > [...] > > I would advice not to use 'import *', if

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Roel Schroeven via Python-list
Op 6/03/2024 om 17:40 schreef Jacob Kruger via Python-list: >>> from scoping2 import * Ah yes, that explains what's happening. After that statement, the name dt_expiry in the current namespace is bound to the same object that the name dt_expiry in the namespace of module scoping2 is bound to.

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Roel Schroeven via Python-list
Op 6/03/2024 om 16:39 schreef Roel Schroeven via Python-list: Op 6/03/2024 om 13:55 schreef Jacob Kruger via Python-list: If you import the contents of that file into the python interpreter, [...] What exactly to you mean by "import the contents of that file into the python interp

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Roel Schroeven via Python-list
Op 6/03/2024 om 13:55 schreef Jacob Kruger via Python-list: If you import the contents of that file into the python interpreter, [...] What exactly to you mean by "import the contents of that file into the python interpreter"? Other people have put your code in a script, executed it, and saw

Re: Is there a way to implement the ** operator on a custom object

2024-02-09 Thread Roel Schroeven via Python-list
Left Right via Python-list schreef op 9/02/2024 om 17:09: In order for the "splat" operator to work, the type of the object must populate slot `tp_as_mapping` with a struct of this type: https://docs.python.org/3/c-api/typeobj.html#c.PyMappingMethods and have some non-null implementations of the

Re: A problem with str VS int.

2023-12-12 Thread Roel Schroeven via Python-list
Op 12/12/2023 om 9:22 schreef Steve GS via Python-list: With all these suggestions on how to fix it, no one seems to answer why it fails only when entering a two-digit number. One and three work fine when comparing with str values. It is interesting that the leading 0 on a two digit worked.

Re: Newline (NuBe Question)

2023-11-26 Thread Roel Schroeven via Python-list
Michael F. Stemper via Python-list schreef op 25/11/2023 om 15:32: On 24/11/2023 21.45,avi.e.gr...@gmail.com wrote: > Grizz[l]y, > > I think the point is not about a sorted list or sorting in general It is > about reasons why maintaining a data structure such as a list in a program > can be

Re: Running a subprocess in a venv

2023-10-21 Thread Roel Schroeven via Python-list
Larry Martell via Python-list schreef op 21/10/2023 om 15:01: I have a python script, and from that I want to run another script in a subprocess in a venv. What is the best way to do that? I could write a file that activates the venv then runs the script, then run that file, but that seems

Re: Where I do ask for a new feature

2023-10-20 Thread Roel Schroeven via Python-list
Op 20/10/2023 om 5:16 schreef Bongo Ferno via Python-list: On Thursday, October 19, 2023 at 11:26:52 PM UTC-3, avi.e...@gmail.com wrote: > There are many ways to make transient variables that disappear at some time > and do we need yet another? Yes, you can create one of those ways but what >

Re: How to write list of integers to file with struct.pack_into?

2023-10-03 Thread Roel Schroeven via Python-list
Jen Kris via Python-list schreef op 2/10/2023 om 17:06: My previous message just went up -- sorry for the mangled formatting.  Here it is properly formatted: I want to write a list of 64-bit integers to a binary file.  Every example I have seen in my research converts it to .txt, but I want

Re: Why doc call `__init__` as a method rather than function?

2023-09-18 Thread Roel Schroeven via Python-list
Op 15/09/2023 om 15:05 schreef anthony.flury via Python-list: Like all of the other methods you shouldn't ever need to call them directly : these are called dunder methods and represent functions and features which are called by other operators. The only recommended way to call

Re: Confusing behavior of PYTHONWARNINGS

2023-09-18 Thread Roel Schroeven via Python-list
Op 16/09/2023 om 10:17 schreef Meowxiik via Python-list: Hello, For the third time I am trying to work with `PYTHONWARNINGS` filter, and for the third time I am having a terrible time. I'd like to seek your assistance, I have a few questions: **Question 1:** Does the environment variable

Re: How to add CC and BCC while sending mails using python

2023-06-20 Thread Roel Schroeven via Python-list
sonam Kumari via Python-list schreef op 20/06/2023 om 9:49: > > I've tried the above code and the bcc address does not receive the message, on the To & CC addresses receive it. > > Here are snippets from my code, perhaps something will stand out to you? > > to = 'e...@domain.gov' > cc =

Re: Should NoneType be iterable?

2023-06-20 Thread Roel Schroeven via Python-list
Op 20/06/2023 om 2:50 schreef Greg Ewing via Python-list: I would question the wisdom of designing an API that can return either a sequence or None. If it normally returns a sequence, and there are no items to return, it should return an empty sequence. I guess it depends on the reason why there

Re: File system path annotations

2023-06-19 Thread Roel Schroeven via Python-list
Op 19/06/2023 om 11:44 schreef Peter Slížik: Thank you, Roel. You've answered all my questions. > [PEP 519]: ...as that can be represented with typing.Union[str, bytes, os.PathLike] easily enough and the hope is users > will slowly gravitate to path objects only. I read a lot on Python and,

Re: File system path annotations

2023-06-19 Thread Roel Schroeven via Python-list
Op 19/06/2023 om 10:43 schreef Peter Slížik via Python-list: Hello, what is the preferred way of annotating file system paths? This StackOverflow answer (and a few others) recommend using the str | os.PathLike union. However, byte arrays can be

Re: f-string syntax deficiency?

2023-06-06 Thread Roel Schroeven via Python-list
Op 6/06/2023 om 16:48 schreef Chris Angelico via Python-list: On Wed, 7 Jun 2023 at 00:42, Roel Schroeven wrote: > (Recently there has been an effort to provide clearer and more useful > error messages; this seems to be a case where there is still room for > improvement: "SyntaxError: invalid