RE: A technique from a chatbot

2024-04-02 Thread AVI GROSS via Python-list
I am a tad confused by a suggestion that any kind of GOTO variant is bad. The suggestion runs counter to the reality that underneath it all, compiled programs are chock full of GOTO variants even for simple things like IF-ELSE. Consider the code here: >> def first_word_beginning_with_e( list_

Re: A technique from a chatbot

2024-04-02 Thread Thomas Passin via Python-list
On 4/2/2024 1:47 PM, Piergiorgio Sartor via Python-list wrote: On 02/04/2024 19.18, Stefan Ram wrote:    Some people can't believe it when I say that chatbots improve    my programming productivity. So, here's a technique I learned    from a chatbot!    It is a structured "break". "Break" still

Re: A technique from a chatbot

2024-04-02 Thread Piergiorgio Sartor via Python-list
On 02/04/2024 19.18, Stefan Ram wrote: Some people can't believe it when I say that chatbots improve my programming productivity. So, here's a technique I learned from a chatbot! It is a structured "break". "Break" still is a kind of jump, you know? So, what's a

Re: Making 'compiled' modules work with multiple python versions on Linux

2024-04-02 Thread Barry via Python-list
> On 1 Apr 2024, at 18:14, Left Right via Python-list > wrote: > > It sounds weird that symbols from Limited API are _missing_ (I'd > expect them to be there no matter what library version you link with). You have to specify the version of the limited API that you want to use. Each release

Re: Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-04-02 Thread Barry via Python-list
> On 1 Apr 2024, at 15:52, Jacob Kruger via Python-list > wrote: > > Found many, many mentions of errors, with some of the same keywords, but, no > resolutions that match my exact issue at all. Try asking the pyinstaller developers. I think there is a mailing list. Barry > > > As in,

magic-wormhole 0.14.0

2024-04-01 Thread meejah via Python-list
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Greetings, I'm pleased to announce that magic-wormhole 0.14.0 is released. Magic Wormhole is a Python library and CLI tool to securely get arbitrary data from one computer to another using short, one-time, human- pronouncable codes and end-to-end

Re: Multiplication

2024-04-01 Thread dn via Python-list
The April Fools joke was on those of us who never received/have yet to receive @Stefan's OP. On 2/04/24 08:02, Avi Gross via Python-list wrote: Is this a April 1 post for fools. Multiplication with an asterisk symbol is built into python. The same symbol used in other contexts has other

Re: Multiplication

2024-04-01 Thread Avi Gross via Python-list
Is this a April 1 post for fools. Multiplication with an asterisk symbol is built into python. The same symbol used in other contexts has other contexts has an assortment of largely unrelated meanings such as meaning everything when used to import. On Mon, Apr 1, 2024, 1:27 PM Piergiorgio

Re: Multiplication

2024-04-01 Thread D'Arcy Cain via Python-list
On 2024-04-01 12:35, Joel Goldstick via Python-list wrote: On Mon, Apr 1, 2024 at 1:26 PM Piergiorgio Sartor via Python-list ^^^ from math import * a = 2 b = 3 print( a * b ) I guess the operator "*" can be imported from any module... :-) No import is necessary. Of

Re: xkcd.com/353 ( Flying with Python )

2024-04-01 Thread PA via Python-list
> On Mar 30, 2024, at 22:09, Johanne Fairchild via Python-list > wrote: > > Sigil is noun. Definitions: > > A seal; a signet. > A sign or an image considered magical. > A seal; a signature. Creating Sigils The origin and design process informing Urbit's generative user avatar system,

Re: Multiplication

2024-04-01 Thread Joel Goldstick via Python-list
On Mon, Apr 1, 2024 at 1:26 PM Piergiorgio Sartor via Python-list wrote: > > On 01/04/2024 10.40, Stefan Ram wrote: > > Q: How can I multiply two variables in Python? I tried: > > > > a = 2 > > b = 3 > > print( ab ) > > > > but it did not work. > > > > A: No, this cannot work. To

Re: xkcd.com/353 ( Flying with Python )

2024-04-01 Thread inhahe via Python-list
On Mon, Apr 1, 2024 at 1:26 PM HenHanna via Python-list < python-list@python.org> wrote: > Johanne Fairchild wrote: > > > HenHanna writes: > > >> https://xkcd.com/1306/ > >> what does SIGIL mean? > > > A glyph used in magic. Or, for Perl, the symbol in front of a

Re: xkcd.com/353 ( Flying with Python )

2024-04-01 Thread HenHanna via Python-list
Johanne Fairchild wrote: HenHanna writes: https://xkcd.com/1306/ what does SIGIL mean? A glyph used in magic. Or, for Perl, the symbol in front of a variable name, such as $, @, and %. Source: https://perldoc.perl.org/perlglossary#sigil Sigil

Re: Multiplication

2024-04-01 Thread Piergiorgio Sartor via Python-list
On 01/04/2024 10.40, Stefan Ram wrote: Q: How can I multiply two variables in Python? I tried: a = 2 b = 3 print( ab ) but it did not work. A: No, this cannot work. To multiply, you need the multiplication operator. You can import the multiplication operator from

Re: xkcd.com/353 ( Flying with Python )

2024-04-01 Thread Blue-Maned_Hawk via Python-list
HenHanna wrote: > https://xkcd.com/1306/ > what does SIGIL mean? I'd define a sigil as a mandatory symbol used to indicate the properties of a name. -- Blue-Maned_Hawk│shortens to Hawk│/blu.mɛin.dʰak/│he/him/his/himself/Mr. blue-maned_hawk.srht.site “Do you know

Re: xkcd.com/353 ( Flying with Python )

2024-04-01 Thread Johanne Fairchild via Python-list
HenHanna writes: > https://xkcd.com/1306/ > what does SIGIL mean? A glyph used in magic. Or, for Perl, the symbol in front of a variable name, such as $, @, and %. Source: https://perldoc.perl.org/perlglossary#sigil Sigil is noun. Definitions: A seal;

Re: xkcd.com/353 ( Flying with Python )

2024-04-01 Thread HenHanna via Python-list
Greg Ewing wrote: On 30/03/24 7:21 pm, HenHanna wrote: https://xkcd.com/1306/ what does  SIGIL   mean? I think its' a Perl term, referring to the $/@/# symbols in front of identifiers. thanks!

xkcd.com/353 ( Flying with Python )

2024-04-01 Thread HenHanna via Python-list
https://xkcd.com/353/ ( Flying with Python ) https://xkcd.com/1306/ what does SIGIL mean? Other xkcd that you like? -- https://mail.python.org/mailman/listinfo/python-list

Re: Making 'compiled' modules work with multiple python versions on Linux

2024-04-01 Thread Left Right via Python-list
It sounds weird that symbols from Limited API are _missing_ (I'd expect them to be there no matter what library version you link with). But, I haven't done this myself, so, what do I know? It would help though to see the actual error. That aside: why do you want to do this? One side effect of

Re: A missing iterator on itertools module?

2024-04-01 Thread Mark Bourne via Python-list
Stefan Ram wrote: ast wrote or quoted: Why did you renamed itertools as _itertools ? Assume I have a module A.py: import math def f(): pass . Assume I have an additional module B.py: import A . Now, when I'm editing "B.py" in IDLE and type "A.", IIRC IDLE will offer me two

Re: Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-04-01 Thread Jacob Kruger via Python-list
Found many, many mentions of errors, with some of the same keywords, but, no resolutions that match my exact issue at all. As in, most of them are mentioning older versions of python, and, mainly different platforms - mac and linux, but, various google searches have not mentioned much of

RE: Can you help me with this memoization simple example?

2024-03-31 Thread AVI GROSS via Python-list
I am not sure if it was made clear that there is a general rule in python for what is HASHABLE and lists are changeable while tuples are not so the latter can be hashed as a simple copy of a list, albeit the contents must also be immutable. The memorize function uses a dictionary to store

Re: Can you help me with this memoization simple example?

2024-03-31 Thread MRAB via Python-list
On 2024-03-31 09:04, marc nicole wrote: Thanks for the first comment which I incorporated but when you say "You can't use a list as a key, but you can use a tuple as a key, provided that the elements of the tuple are also immutable." does it mean  the result of sum of the array is not

Re: xkcd.com/353 ( Flying with Python )

2024-03-31 Thread Peter J. Holzer via Python-list
On 2024-03-31 12:27:34 -0600, Mats Wichmann via Python-list wrote: > On 3/30/24 10:31, MRAB via Python-list wrote: > > On 2024-03-30 11:25, Skip Montanaro via Python-list wrote: > > > > > https://xkcd.com/1306/ > > > > >   what does  SIGIL   mean? > > > > > > > > I think

Re: xkcd.com/353 ( Flying with Python )

2024-03-31 Thread Peter J. Holzer via Python-list
On 2024-03-30 17:58:08 +, Alan Gauld via Python-list wrote: > On 30/03/2024 07:04, Greg Ewing via Python-list wrote: > > On 30/03/24 7:21 pm, HenHanna wrote: > >> https://xkcd.com/1306/ > >> what does  SIGIL   mean? > > > > I think its' a Perl term, referring to the

Re: xkcd.com/353 ( Flying with Python )

2024-03-31 Thread Mats Wichmann via Python-list
On 3/30/24 10:31, MRAB via Python-list wrote: On 2024-03-30 11:25, Skip Montanaro via Python-list wrote: > https://xkcd.com/1306/ >   what does  SIGIL   mean? I think its' a Perl term, referring to the $/@/# symbols in front of identifiers. I wouldn't consider '@' to

Re: Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-03-31 Thread Barry via Python-list
> On 31 Mar 2024, at 13:24, Jacob Kruger via Python-list > wrote: > > pkg_resources.DistributionNotFound: The 'altgraph' distribution was not found > and is required by the application I think I have seen this error being discussed before… A web search for pyinstaller and that error leads

Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-03-31 Thread Jacob Kruger via Python-list
This started happening this past week, and, while it's worked fine in the past, the moment I try to launch the pyinstaller process at all, to generate compiled output, or even if just launch it with no command line options, I receive the following error message:

Re: Can you help me with this memoization simple example?

2024-03-31 Thread marc nicole via Python-list
Thanks for the first comment which I incorporated but when you say "You can't use a list as a key, but you can use a tuple as a key, provided that the elements of the tuple are also immutable." does it mean the result of sum of the array is not convenient to use as key as I do? Which tuple I

Re: Can you help me with this memoization simple example?

2024-03-30 Thread MRAB via Python-list
On 2024-03-31 00:09, marc nicole via Python-list wrote: I am creating a memoization example with a function that adds up / averages the elements of an array and compares it with the cached ones to retrieve them in case they are already stored. In addition, I want to store only if the result of

Can you help me with this memoization simple example?

2024-03-30 Thread marc nicole via Python-list
I am creating a memoization example with a function that adds up / averages the elements of an array and compares it with the cached ones to retrieve them in case they are already stored. In addition, I want to store only if the result of the function differs considerably (passes a threshold e.g.

Re: xkcd.com/353 ( Flying with Python )

2024-03-30 Thread Alan Gauld via Python-list
On 30/03/2024 07:04, Greg Ewing via Python-list wrote: > On 30/03/24 7:21 pm, HenHanna wrote: >> https://xkcd.com/1306/ >> what does  SIGIL   mean? > > I think its' a Perl term, referring to the $/@/# symbols in front of > identifiers. There seem to be several

Re: xkcd.com/353 ( Flying with Python )

2024-03-30 Thread MRAB via Python-list
On 2024-03-30 11:25, Skip Montanaro via Python-list wrote: > https://xkcd.com/1306/ > what does SIGIL mean? I think its' a Perl term, referring to the $/@/# symbols in front of identifiers. I had a vague recollection of hearing it elsewhere (*Game of Thrones,*

Re: xkcd.com/353 ( Flying with Python )

2024-03-30 Thread Skip Montanaro via Python-list
> > > https://xkcd.com/1306/ > > what does SIGIL mean? > > I think its' a Perl term, referring to the $/@/# symbols in front of > identifiers. > I had a vague recollection of hearing it elsewhere (*Game of Thrones,* on the armies' battle flags?), but didn't know what

Re: xkcd.com/353 ( Flying with Python )

2024-03-30 Thread Greg Ewing via Python-list
On 30/03/24 7:21 pm, HenHanna wrote: https://xkcd.com/1306/ what does  SIGIL   mean? I think its' a Perl term, referring to the $/@/# symbols in front of identifiers. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Making 'compiled' modules work with multiple python versions on Linux

2024-03-29 Thread Barry Scott via Python-list
> On 29 Mar 2024, at 16:09, Olivier B. > wrote: > > It is not a symlink on my system, where i built python myself, but a > 15KB so file. But it seems to lack lots of python symbols. > > Maybe what i should do is actually make libpython.so a physical copy > of libpyton311.so before linking to

Re: Making 'compiled' modules work with multiple python versions on Linux

2024-03-29 Thread Olivier B. via Python-list
It is not a symlink on my system, where i built python myself, but a 15KB so file. But it seems to lack lots of python symbols. Maybe what i should do is actually make libpython.so a physical copy of libpyton311.so before linking to it, so now on any system the module would look to load

Re: Making 'compiled' modules work with multiple python versions on Linux

2024-03-29 Thread Barry via Python-list
> On 28 Mar 2024, at 16:13, Olivier B. via Python-list > wrote: > > But on Linux, it seems that linking to libpython3.so instead of > libpython3.11.so.1.0 does not have the same effect, and results in > many unresolved python symbols at link time > > Is this functionality only available on

Re: A missing iterator on itertools module?

2024-03-28 Thread ast via Python-list
Le 28/03/2024 à 18:07, Stefan Ram a écrit : ast wrote or quoted: s1 = "AZERTY" s2 = "QSDFGH" s3 = "WXCVBN" and I need an itertor who delivers A Q W Z S C E D C ... I didn't found anything in itertools to do the job. So I came up with this solution: list(chain.from_iterable(zip("AZERTY",

Re: A missing iterator on itertools module?

2024-03-28 Thread ast via Python-list
Le 28/03/2024 à 17:45, ast a écrit : A Q W Z S C E D C ... sorry A Q W Z S X E D C -- https://mail.python.org/mailman/listinfo/python-list

A missing iterator on itertools module?

2024-03-28 Thread ast via Python-list
Hello Suppose I have these 3 strings: s1 = "AZERTY" s2 = "QSDFGH" s3 = "WXCVBN" and I need an itertor who delivers A Q W Z S C E D C ... I didn't found anything in itertools to do the job. So I came up with this solution: list(chain.from_iterable(zip("AZERTY", "QSDFGH", "WXCVBN"))) ['A',

Making 'compiled' modules work with multiple python versions on Linux

2024-03-28 Thread Olivier B. via Python-list
I have a python module that includes some C++ code that links with the Python C API I have now modified the c++ code so that it only uses the Limited API, and linked with python3.lib instead of python311.lib. I can now use that python module with different python versions on Windows But on

RE: Popping key causes dict derived from object to revert to object (3/25/2024)

2024-03-27 Thread Dr. F. M. (Mike) Covington via Python-list
Hello, all. I guess I'm just not seeing this dictionary pop() problem you're having. What version of Python are you using? Is there something I'm missing? If I've made an obvious oversight, please forgive me and explain. Thanks! PyCharm (2023.1.1) REPL running Python 3.12:

RE: Popping key causes dict derived from object to revert to object

2024-03-25 Thread AVI GROSS via Python-list
Lori, The list comprehension you are thinking of does work if you change things a bit. But it is not a great idea as a main purpose of a dict is that using a hash means things are found in linear time. A comprehension iterates on all values. If you wanted to select just some items to keep in a

RE: Popping key causes dict derived from object to revert to object

2024-03-25 Thread AVI GROSS via Python-list
I am glad, Lori, you found a solution another way. Actually, Lori, I think you were right in looking for a built-in method that complements pop() by returning everything else other than the item mentioned. There are philosophical and practical considerations that were no doubt considered and a

Re: Popping key causes dict derived from object to revert to object

2024-03-25 Thread Grant Edwards via Python-list
On 2024-03-25, Loris Bennett via Python-list wrote: > Grant Edwards writes: > >> On 2024-03-22, Loris Bennett via Python-list wrote: >> >>> Yes, I was mistakenly thinking that the popping the element would >>> leave me with the dict minus the popped key-value pair. >> >> It does. > > Indeed,

Re: Popping key causes dict derived from object to revert to object

2024-03-25 Thread Loris Bennett via Python-list
"Michael F. Stemper" writes: > On 25/03/2024 01.56, Loris Bennett wrote: >> Grant Edwards writes: >> >>> On 2024-03-22, Loris Bennett via Python-list wrote: >>> Yes, I was mistakenly thinking that the popping the element would leave me with the dict minus the popped key-value pair.

Re: Popping key causes dict derived from object to revert to object

2024-03-25 Thread Jon Ribbens via Python-list
On 2024-03-25, Loris Bennett wrote: > "Michael F. Stemper" writes: > >> On 25/03/2024 01.56, Loris Bennett wrote: >>> Grant Edwards writes: >>> On 2024-03-22, Loris Bennett via Python-list wrote: > Yes, I was mistakenly thinking that the popping the element would >

Re: Popping key causes dict derived from object to revert to object

2024-03-25 Thread Michael F. Stemper via Python-list
On 25/03/2024 01.56, Loris Bennett wrote: Grant Edwards writes: On 2024-03-22, Loris Bennett via Python-list wrote: Yes, I was mistakenly thinking that the popping the element would leave me with the dict minus the popped key-value pair. It does. Indeed, but I was thinking in the

Re: Popping key causes dict derived from object to revert to object

2024-03-25 Thread Loris Bennett via Python-list
Grant Edwards writes: > On 2024-03-22, Loris Bennett via Python-list wrote: > >> Yes, I was mistakenly thinking that the popping the element would >> leave me with the dict minus the popped key-value pair. > > It does. Indeed, but I was thinking in the context of dict_list = [d.pop('a')

Re: ANN: EmPy 4.1 -- a powerful, robust and mature templating system for Python

2024-03-25 Thread Barry via Python-list
You should considered also announcing on https://discuss.python.org/ which is a lot more active then this list. Barry > On 25 Mar 2024, at 04:13, Erik Max Francis via Python-list > wrote: > > I'm pleased to announce the release of EmPy 4.1. > > The 4._x_ series is a modernization of the

Re: Popping key causes dict derived from object to revert to object

2024-03-25 Thread Loris Bennett via Python-list
writes: > Loris wrote: > > "Yes, I was mistakenly thinking that the popping the element would leave > me with the dict minus the popped key-value pair. Seem like there is no > such function." > > Others have tried to explain and pointed out you can del and then use the > changed dict. > > But

Re: the name ``wheel''

2024-03-24 Thread Barry via Python-list
> On 22 Mar 2024, at 20:28, Mats Wichmann via Python-list > wrote: > > pip is still a separate package in the .rpm world. which makes sense on a > couple of levels: Yes it’s a separate package, but it’s always installed. At least on Fedora. I agree it makes sense to package it separately,

Re: Using a background thread with asyncio/futures with flask

2024-03-24 Thread Frank Millman via Python-list
On 2024-03-23 3:25 PM, Frank Millman via Python-list wrote: It is not pretty! call_soon_threadsafe() is a loop function, but the loop is not accessible from a different thread. Therefore I include a reference to the loop in the message passed to in_queue, which in turn passes it to

Re: Using a background thread with asyncio/futures with flask

2024-03-23 Thread Frank Millman via Python-list
On 2024-03-22 12:08 PM, Thomas Nyberg via Python-list wrote: Hi, Yeah so flask does support async (when installed with `pip3 install flask[async]), but you are making a good point that flask in this case is a distraction. Here's an example using just the standard library that exhibits the

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Mark Bourne via Python-list
Thomas Nyberg wrote: Hi, Yeah so flask does support async (when installed with `pip3 install flask[async]), but you are making a good point that flask in this case is a distraction. Here's an example using just the standard library that exhibits the same issue: `app.py` ``` import asyncio

Re: the name ``wheel''

2024-03-22 Thread Mats Wichmann via Python-list
On 3/22/24 11:45, Barry via Python-list wrote:  On 22 Mar 2024, at 15:25, Gilmeh Serda via Python-list wrote: Many if not most Linux distributions do not include pip by default. Really? It came with Manjaro. Debian and Ubuntu require you to install pip as a separate package. Also puts

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Dieter Maurer via Python-list
dieter.mau...@online.de wrote at 2024-3-22 18:28 +0100: >Thomas Nyberg wrote at 2024-3-22 11:08 +0100: >> ... `future` use across thread boundaries ... >> Here's an example using just the standard library that >> exhibits the same issue: > ... >For use across thread boundaries, you likely will use

RE: Popping key causes dict derived from object to revert to object

2024-03-22 Thread AVI GROSS via Python-list
Loris wrote: "Yes, I was mistakenly thinking that the popping the element would leave me with the dict minus the popped key-value pair. Seem like there is no such function." Others have tried to explain and pointed out you can del and then use the changed dict. But consider the odd concept of

Re: the name ``wheel''

2024-03-22 Thread Barry via Python-list
 > On 22 Mar 2024, at 15:25, Gilmeh Serda via Python-list > wrote: > >> Many if not most Linux distributions do not include pip by default. > > Really? It came with Manjaro. Debian and Ubuntu require you to install pip as a separate package. Also puts venv in its own package. Fedora leaves

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Dieter Maurer via Python-list
Thomas Nyberg wrote at 2024-3-22 11:08 +0100: > ... `future` use across thread boundaries ... > Here's an example using just the standard library that > exhibits the same issue: I think all `asyncio` objects (futures, tasks, ...) are meant to be used in a single thread. If you use them across

Re: Popping key causes dict derived from object to revert to object

2024-03-22 Thread Grant Edwards via Python-list
On 2024-03-22, Loris Bennett via Python-list wrote: > Yes, I was mistakenly thinking that the popping the element would > leave me with the dict minus the popped key-value pair. It does. > Seem like there is no such function. Yes, there is. You can do that with either pop or del: >>> d =

Re: the name ``wheel''

2024-03-22 Thread Thomas Schweikle via Python-list
Am Do., 21.März.2024 um 18:58:26 schrieb Johanne Fairchild via Python-list: r...@zedat.fu-berlin.de (Stefan Ram) writes: Johanne Fairchild wrote or quoted: Why is a whl-package called a ``wheel''? Is it just a pronunciation for the extension WHL or is it really a name? PyPi in its

Re: Popping key causes dict derived from object to revert to object

2024-03-22 Thread Loris Bennett via Python-list
Mark Bourne writes: > Loris Bennett wrote: >> Hi, >> I am using SQLAlchemy to extract some rows from a table of 'events'. >> From the call to the DB I get a list of objects of the type >>sqlalchemy.orm.state.InstanceState >> I would like to print these rows to the terminal using the >>

Re: Popping key causes dict derived from object to revert to object

2024-03-22 Thread Mark Bourne via Python-list
Loris Bennett wrote: Hi, I am using SQLAlchemy to extract some rows from a table of 'events'. From the call to the DB I get a list of objects of the type sqlalchemy.orm.state.InstanceState I would like to print these rows to the terminal using the 'tabulate' package, the documentation for

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Frank Millman via Python-list
On 2024-03-22 1:23 PM, Frank Millman via Python-list wrote: On 2024-03-22 12:09 PM, Frank Millman via Python-list wrote: I am no expert. However, I do have something similar in my app, and it works. I do not use 'await future', I use 'asyncio.wait_for(future)'. I tested it and it did not

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Frank Millman via Python-list
On 2024-03-22 12:09 PM, Frank Millman via Python-list wrote: I am no expert. However, I do have something similar in my app, and it works. I do not use 'await future', I use 'asyncio.wait_for(future)'. I tested it and it did not work. I am not sure, but I think the problem is that you

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Lars Liedtke via Python-list
Sorry, must have missed that :-/ Lars Liedtke Lead Developer [Tel.] +49 721 98993- [Fax] +49 721 98993- [E-Mail]l...@solute.de solute GmbH Zeppelinstraße 15 76185 Karlsruhe Germany [Marken] Geschäftsführer | Managing Director: Dr. Thilo Gans, Bernd

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Frank Millman via Python-list
On 2024-03-20 10:22 AM, Thomas Nyberg via Python-list wrote: Hello, I have a simple (and not working) example of what I'm trying to do. This is a simplified version of what I'm trying to achieve (obviously the background workers and finalizer functions will do more later): `app.py` ```

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Thomas Nyberg via Python-list
Hi, Yeah so flask does support async (when installed with `pip3 install flask[async]), but you are making a good point that flask in this case is a distraction. Here's an example using just the standard library that exhibits the same issue: `app.py` ``` import asyncio import threading

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Chris Angelico via Python-list
On Fri, 22 Mar 2024 at 18:35, Lars Liedtke via Python-list wrote: > > Hey, > > As far as I know (might be old news) flask does not support asyncio. > > You would have to use a different framework, like e.g. FastAPI or similar. > Maybe someone has already written "flask with asyncio" but I don't

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Lars Liedtke via Python-list
Hey, As far as I know (might be old news) flask does not support asyncio. You would have to use a different framework, like e.g. FastAPI or similar. Maybe someone has already written "flask with asyncio" but I don't know about that. Cheers Lars Lars Liedtke Lead Developer [Tel.] +49 721

Re: the name ``wheel''

2024-03-21 Thread Thomas Passin via Python-list
On 3/21/2024 4:19 PM, Grant Edwards via Python-list wrote: On 2024-03-21, MRAB via Python-list wrote: As it's recommended to use the Python Launcher py on Windows, I use that instead: py -m pip install something because it gives better support if you have multiple versions of Python

Re: the name ``wheel''

2024-03-21 Thread Grant Edwards via Python-list
On 2024-03-21, MRAB via Python-list wrote: > As it's recommended to use the Python Launcher py on Windows, I use > that instead: > > py -m pip install something > > because it gives better support if you have multiple versions of > Python installed. I adopted that practice years ago on Linux as

Re: the name ``wheel''

2024-03-21 Thread MRAB via Python-list
On 2024-03-21 11:36, Johanne Fairchild via Python-list wrote: Why is a whl-package called a ``wheel''? Is it just a pronunciation for the extension WHL or is it really a name? Also, it seems that when I install Python on Windows, it doesn't come with pip ready to run. I had to say python

Re: the name ``wheel''

2024-03-21 Thread Johanne Fairchild via Python-list
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Johanne Fairchild wrote or quoted: >>Why is a whl-package called a ``wheel''? Is it just a pronunciation for >>the extension WHL or is it really a name? > > PyPi in its initial state was named "cheese shop", as the famous > part in the show

Re: the name ``wheel''

2024-03-21 Thread Left Right via Python-list
I believe that the name "Wheel" was a reference to "reinventing the wheel". But I cannot find a quote to support this claim. I think the general sentiment was that it was the second attempt by the Python community to come up with a packaging format (first being Egg), and so they were reinventing

Re: Popping key causes dict derived from object to revert to object

2024-03-21 Thread Dieter Maurer via Python-list
Loris Bennett wrote at 2024-3-21 10:56 +0100: > ... >So as I understand it, I need to convert the InstanceState-objects to, >say, dicts, in order to print them. However I also want to remove one >of the keys from the output and assumed I could just pop it off each >event dict, thus: > >

the name ``wheel''

2024-03-21 Thread Johanne Fairchild via Python-list
Why is a whl-package called a ``wheel''? Is it just a pronunciation for the extension WHL or is it really a name? Also, it seems that when I install Python on Windows, it doesn't come with pip ready to run. I had to say python -m ensurepip and then I saw that a pip on a whl-package was

Popping key causes dict derived from object to revert to object

2024-03-21 Thread Loris Bennett via Python-list
Hi, I am using SQLAlchemy to extract some rows from a table of 'events'. >From the call to the DB I get a list of objects of the type sqlalchemy.orm.state.InstanceState I would like to print these rows to the terminal using the 'tabulate' package, the documentation for which says The

Using a background thread with asyncio/futures with flask

2024-03-20 Thread Thomas Nyberg via Python-list
Hello, I have a simple (and not working) example of what I'm trying to do. This is a simplified version of what I'm trying to achieve (obviously the background workers and finalizer functions will do more later): `app.py` ``` import asyncio import threading import time from queue import

Re: Configuring an object via a dictionary

2024-03-20 Thread Dan Sommers via Python-list
On 2024-03-20 at 09:49:54 +0100, Roel Schroeven via Python-list wrote: > You haven't only checked for None! You have rejected *every* falsish value, > even though they may very well be acceptable values. OTOH, only you can answer these questions about your situations. Every application, every

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: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

2024-03-20 Thread Chris Angelico via Python-list
On Wed, 20 Mar 2024 at 18:31, Greg Ewing via Python-list wrote: > > On 20/03/24 4:14 pm, Lawrence D'Oliveiro wrote: > > not to > > mention the latency when there isn’t quite enough memory for an allocation > > and you have to wait until the next GC run to proceed. Run the GC a > > thousand times

Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

2024-03-20 Thread Greg Ewing via Python-list
On 20/03/24 4:14 pm, Lawrence D'Oliveiro wrote: not to mention the latency when there isn’t quite enough memory for an allocation and you have to wait until the next GC run to proceed. Run the GC a thousand times a second, and the latency is still 1 millisecond. That's not the way it usually

Re: Configuring an object via a dictionary

2024-03-19 Thread Pokemon Chw via Python-list
It's too complicated, there's no need for this def __init__(self, config): self.__dict__ = config self.connection = None """ other code . """ Note that you need to keep the fields in the config dict named the same as the fields you want to be

[RELEASE] Python 3.10.14, 3.9.19, and 3.8.19 is now available

2024-03-19 Thread Łukasz Langa via Python-list
Howdy! Those are the boring security releases that aren’t supposed to bring anything new. But not this time! We do have a bit of news, actually. But first things first: go update your systems!

Re: Configuring an object via a dictionary

2024-03-18 Thread Loris Bennett via Python-list
Tobiah writes: > I should mention that I wanted to answer your question, > but I wouldn't actually do this. I'd rather opt for > your self.config = config solution. The config options > should have their own namespace. > > I don't mind at all referencing foo.config['option'], > or you could

Re: Configuring an object via a dictionary

2024-03-18 Thread Tobiah via Python-list
I should mention that I wanted to answer your question, but I wouldn't actually do this. I'd rather opt for your self.config = config solution. The config options should have their own namespace. I don't mind at all referencing foo.config['option'], or you could make foo.config an object by

Re: Configuring an object via a dictionary

2024-03-18 Thread Tobiah via Python-list
On 3/15/24 02:30, Loris Bennett wrote: Hi, I am initialising an object via the following: def __init__(self, config): self.connection = None self.source_name = config['source_name'] self.server_host = config['server_host'] However, with a view to asking

Re: Configuring an object via a dictionary

2024-03-18 Thread Anders Munch via Python-list
dn wrote: >Loris Bennett wrote: >> However, with a view to asking forgiveness rather than >> permission, is there some simple way just to assign the dictionary >> elements which do in fact exist to self-variables? > >Assuming config is a dict: > > self.__dict__.update( config ) Here's

[Ann] managesieve v0.8 released

2024-03-18 Thread Hartmut Goebel via Python-list
Announcing: managesieve 0.8     RFC-5804 Manage Sieve client library for remotely managing Sieve scripts,     including an user application (the interactive 'sieveshell'). :Homepage: https://managesieve.readthedocs.io/ :Author:   Hartmut Goebel :License:   - for the managesieve

RE: Configuring an object via a dictionary

2024-03-17 Thread AVI GROSS via Python-list
If we are bringing up other languages, let's return to what was part of the original question. How van a dictionary be used in python if your goal is to sort of use it to instantiate it into a set of variables and values inside the local or global or other namespaces? Can we learn anything

Re: MTG: Introductions to PyQt and DataClasses

2024-03-17 Thread dn via Python-list
On 18/03/24 10:02, Jim Schwartz wrote: Actually, I have a sleep disorder that requires me to keep a constant sleep schedule. Thats why I asked. At a weekend meeting, discussion swirled around topics such as the best way to learn/work, how much work we should attempt in one sitting,

Re: Configuring an object via a dictionary

2024-03-17 Thread dn via Python-list
On 18/03/24 04:11, Peter J. Holzer via Python-list wrote: On 2024-03-17 17:15:32 +1300, dn via Python-list wrote: On 17/03/24 12:06, Peter J. Holzer via Python-list wrote: On 2024-03-16 08:15:19 +, Barry via Python-list wrote: On 15 Mar 2024, at 19:51, Thomas Passin via Python-list

Re: MTG: Introductions to PyQt and DataClasses

2024-03-17 Thread Jim Schwartz via Python-list
Actually, I have a sleep disorder that requires me to keep a constant sleep schedule. Thats why I asked. Sent from my iPhone > On Mar 17, 2024, at 3:36 PM, dn via Python-list > wrote: > > On 17/03/24 23:40, Jim Schwartz wrote: >> Will it be recorded? > > Better than that (assumption)

Re: MTG: Introductions to PyQt and DataClasses

2024-03-17 Thread dn via Python-list
On 17/03/24 23:40, Jim Schwartz wrote: Will it be recorded? Better than that (assumption) "coming soon" - please join-up or keep an eye on PySprings' Meetup ANNs: https://www.meetup.com/pysprings/ On Mar 17, 2024, at 1:47 AM, dn via Python-list wrote: The Auckland Branch of NZPUG meets

Re: Configuring an object via a dictionary

2024-03-17 Thread Peter J. Holzer via Python-list
On 2024-03-17 17:15:32 +1300, dn via Python-list wrote: > On 17/03/24 12:06, Peter J. Holzer via Python-list wrote: > > On 2024-03-16 08:15:19 +, Barry via Python-list wrote: > > > > On 15 Mar 2024, at 19:51, Thomas Passin via Python-list > > > > wrote: > > > > I've always like writing using

Re: MTG: Introductions to PyQt and DataClasses

2024-03-17 Thread Jim Schwartz via Python-list
Will it be recorded? Sent from my iPhone > On Mar 17, 2024, at 1:47 AM, dn via Python-list > wrote: > > The Auckland Branch of NZPUG meets this Wednesday, 20 March at 1830 NZDT > (0530 UTC, midnight-ish Tue/Wed in American time-zones), for a virtual > meeting. > > Part 1: Learn the

MTG: Introductions to PyQt and DataClasses

2024-03-17 Thread dn via Python-list
The Auckland Branch of NZPUG meets this Wednesday, 20 March at 1830 NZDT (0530 UTC, midnight-ish Tue/Wed in American time-zones), for a virtual meeting. Part 1: Learn the basics of PyQt with code examples. Hannan Khan is currently consulting as a Data Scientist for the (US) National Oceanic

<    1   2   3   4   5   6   7   8   9   10   >