mypy question

2023-12-29 Thread Karsten Hilbert via Python-list
Hi all,

I am not sure why mypy thinks this

gmPG2.py:554: error: Argument "queries" to "run_rw_queries" has incompatible 
type "List[Dict[str, str]]"; expected
"List[Dict[str, Union[str, List[Any], Dict[str, Any"  [arg-type]
rows, idx = run_rw_queries(link_obj = conn, queries = 
queries, return_data = True)
  
^~~

should be flagged. The intent is for "queries" to be

a list
of dicts
with keys of str
and values of
str OR
list of anything OR
dict with
keys of str
and values of anything

I'd have thunk list[dict[str,str]] matches that ?

This is on Python 3.11.2 with mypy 1.0.1 on Debian.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: mypy question

2023-12-29 Thread Karsten Hilbert via Python-list
Am Fri, Dec 29, 2023 at 01:15:29PM +0100 schrieb Karsten Hilbert via 
Python-list:

> I am not sure why mypy thinks this
>
> gmPG2.py:554: error: Argument "queries" to "run_rw_queries" has incompatible 
> type "List[Dict[str, str]]"; expected
> "List[Dict[str, Union[str, List[Any], Dict[str, Any"  [arg-type]
> rows, idx = run_rw_queries(link_obj = conn, queries = 
> queries, return_data = True)
>   
> ^~~
>
> should be flagged. The intent is for "queries" to be
>
> a list
>   of dicts
>   with keys of str
>   and values of
>   str OR
>   list of anything OR
>   dict with
>   keys of str
>   and values of anything
>
> I'd have thunk list[dict[str,str]] matches that ?
>
> This is on Python 3.11.2 with mypy 1.0.1 on Debian.

For completeness, this was the mypy call signature:

mypy --pretty --allow-redefinition --no-strict-optional 
--ignore-missing-imports --follow-imports silent --show-error-codes 
--warn-unused-ignores gmPG2.py

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Left Right via Python-list
Wow. That place turned out to be the toxic pit I didn't expect.

It's a shame that a public discussion of public goods was entrusted to
a bunch of gatekeepers with no sense of responsibility for the thing
they keep the keys to.

On Wed, Dec 27, 2023 at 9:49 PM Left Right  wrote:
>
> Thanks. I tried asking there.
>
> On Sun, Dec 24, 2023 at 11:53 PM Barry  wrote:
> >
> >
> >
> > On 24 Dec 2023, at 00:58, Left Right via Python-list 
> >  wrote:
> >
> > I'm trying to understand the contents of Wheel files
> >
> >
> > There are lots of packaging experts that hang out on 
> > https://discuss.python.org/ you are likely to get a response there if not 
> > here replies.
> >
> > Barry
> >
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Oscar Benjamin via Python-list
On Fri, 29 Dec 2023 at 13:04, Left Right via Python-list
 wrote:
>
> Wow. That place turned out to be the toxic pit I didn't expect.
>
> It's a shame that a public discussion of public goods was entrusted to
> a bunch of gatekeepers with no sense of responsibility for the thing
> they keep the keys to.

Here is the discussion referred to:
https://discuss.python.org/t/what-is-install-paths-to-in-wheel-file/42005

I don't see anything "toxic" in that discussion. You asked questions
and people took the time to give clear answers.

The basic answer to your question is that PEP 491 was never completed
and so there is no accepted specification of the Install-Paths-To
feature that it had been intended to introduce. The PEP text itself is
reasonably clear about this and also links to the up to date
specifications:
https://peps.python.org/pep-0491/#pep-deferral

Instead for understanding the wheel format the appropriate document is:
https://packaging.python.org/en/latest/specifications/binary-distribution-format/

That document does not mention Install-Paths-To because it documents
the standards as defined and accepted via the PEP process but PEP 491
was never accepted.

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


Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Left Right via Python-list
That's not the discussion that was toxic. But the one that was --
doesn't exist anymore since the forum owners deleted it.

The part where the forum owners delete whatever they disagree with is
the toxic part.

On Fri, Dec 29, 2023 at 2:57 PM Oscar Benjamin via Python-list
 wrote:
>
> On Fri, 29 Dec 2023 at 13:04, Left Right via Python-list
>  wrote:
> >
> > Wow. That place turned out to be the toxic pit I didn't expect.
> >
> > It's a shame that a public discussion of public goods was entrusted to
> > a bunch of gatekeepers with no sense of responsibility for the thing
> > they keep the keys to.
>
> Here is the discussion referred to:
> https://discuss.python.org/t/what-is-install-paths-to-in-wheel-file/42005
>
> I don't see anything "toxic" in that discussion. You asked questions
> and people took the time to give clear answers.
>
> The basic answer to your question is that PEP 491 was never completed
> and so there is no accepted specification of the Install-Paths-To
> feature that it had been intended to introduce. The PEP text itself is
> reasonably clear about this and also links to the up to date
> specifications:
> https://peps.python.org/pep-0491/#pep-deferral
>
> Instead for understanding the wheel format the appropriate document is:
> https://packaging.python.org/en/latest/specifications/binary-distribution-format/
>
> That document does not mention Install-Paths-To because it documents
> the standards as defined and accepted via the PEP process but PEP 491
> was never accepted.
>
> --
> Oscar
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Chris Angelico via Python-list
On Sat, 30 Dec 2023 at 01:16, Left Right via Python-list
 wrote:
>
> That's not the discussion that was toxic. But the one that was --
> doesn't exist anymore since the forum owners deleted it.
>
> The part where the forum owners delete whatever they disagree with is
> the toxic part.

Yeah, because you have the God-given RIGHT to be able to say anything
you like, on anyone's web site, and nobody's allowed to delete
anything you say! That's how it goes, right?

You're most welcome to avoid the Python Discourse if you dislike
moderated forums, but do be aware that python-list is ALSO moderated,
and that completely unmoderated forums are far far more toxic than
anything I've seen on the Python Discourse.

Don't let the door hit you on the way out.

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


Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Left Right via Python-list
> Yeah, because you have the God-given RIGHT to be able to say anything
> you like, on anyone's web site, and nobody's allowed to delete
> anything you say! That's how it goes, right?

I don't believe in god, and I don't believe he / she can give me
rights.  What I believe in is that Python is a public good, and its
status is enshrined in the license it uses. I also believe that Python
Foundation and PyPA are the public bodies that are meant to, beside
other things, make sure that the public good stays that way.  Me,
being a member of the public, for whom the good is mean, means I have
a right to discuss, complain or argue about the nature or function of
this good.  I, or you, or anyone else don't need god to make this
happen. The rights I'm talking about are a consequence of the license
that governs Python and various satellite projects.

> Don't let the door hit you on the way out.

Oh, great. Here we go again.  You don't even know what this discussion
is about, but decided to be rude.  I mean, you don't have to be
curious, and there's no need for you to try to figure out what this is
about, but being rude without provocation?  Just why?  What do you
stand to gain from this?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: mypy question

2023-12-29 Thread Mats Wichmann via Python-list

On 12/29/23 05:15, Karsten Hilbert via Python-list wrote:

Hi all,

I am not sure why mypy thinks this

gmPG2.py:554: error: Argument "queries" to "run_rw_queries" has incompatible type 
"List[Dict[str, str]]"; expected
"List[Dict[str, Union[str, List[Any], Dict[str, Any"  [arg-type]
 rows, idx = run_rw_queries(link_obj = conn, queries = 
queries, return_data = True)
   
^~~

should be flagged. The intent is for "queries" to be

a list
of dicts
with keys of str
and values of
str OR
list of anything OR
dict with
keys of str
and values of anything

I'd have thunk list[dict[str,str]] matches that ?


Dict[str, str] means the key type and value type should both be strings, 
but in your retelling above you indicate lots of possible value types... 
actually the mypy guess seems to be a pretty good recreation of your 
psuedo-code description.

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


Re: mypy question

2023-12-29 Thread Karsten Hilbert via Python-list
Am Fri, Dec 29, 2023 at 07:49:17AM -0700 schrieb Mats Wichmann via Python-list:

> >I am not sure why mypy thinks this
> >
> >gmPG2.py:554: error: Argument "queries" to "run_rw_queries" has incompatible 
> >type "List[Dict[str, str]]"; expected
> >"List[Dict[str, Union[str, List[Any], Dict[str, Any"  [arg-type]
> > rows, idx = run_rw_queries(link_obj = conn, queries = 
> > queries, return_data = True)
> >   
> > ^~~
> >
> >should be flagged. The intent is for "queries" to be
> >
> >a list
> > of dicts
> > with keys of str
> > and values of
> > str OR
> > list of anything OR
> > dict with
> > keys of str
> > and values of anything
> >
> >I'd have thunk list[dict[str,str]] matches that ?
>
> Dict[str, str] means the key type and value type should both be strings,

Indeed, I know that much, list[dict[str, str]] is what is getting
passed in in this particular invocation of run_rw_queries().

For what it's worth here's the signature of that function:

def run_rw_queries (
link_obj:_TLnkObj=None,
queries:list[dict[str, str | list | dict[str, Any]]]=None,
end_tx:bool=False,
return_data:bool=None,
get_col_idx:bool=False,
verbose:bool=False
) -> tuple[list[dbapi.extras.DictRow], dict[str, int] | None]:

Given that I would have thought that passing in
list[dict[str, str]] for "queries" ought to be type safe.
Mypy indicates otherwise which I am not grokking as to why.

> but in your
> retelling above you indicate lots of possible value types... actually the 
> mypy guess
> seems to be a pretty good recreation of your psuedo-code description.

I agree that mypy's grasp of my intent from

queries:list[dict[str, str | list | dict[str, Any]]]=None,

into

"List[Dict[str, Union[str, List[Any], Dict[str, Any"

seems accurate. I just don't understand why list[dict[str,
str]] should not pass that construct.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How/where to store calibration values - written by program A, read by program B

2023-12-29 Thread Grant Edwards via Python-list
On 2023-12-28, Peter J. Holzer via Python-list  wrote:
> On 2023-12-28 05:20:07 +, rbowman via Python-list wrote:
>> On Wed, 27 Dec 2023 03:53:42 -0600, Greg Walters wrote:
>> > The biggest caveat is that the shared variable MUST exist before it can
>> > be examined or used (not surprising).
>> 
>> There are a few other questions. Let's say config.py contains a variable 
>> like 'font' that is a user set preference or a calibration value 
>> calculated by A to keep with the thread title. Assuming both scripts are 
>> running, how does the change get propagated to B after it is set in A
>
> It isn't. The variable is set purely in memory. This is a mechanism to
> share a value between multiple modules used by the same process, not to
> share between multiple processes (whether they run the same or different
> scripts)
>
>> and written to the shared file?
>
> Nothing is ever written to a file.

Then how does it help the OP to propogate clibration values from one
program to another or from one program run to the next run?

> You could of course write python files from a python script (in fact I
> do this), but that's not what this pattern is about, AFAICS.


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


RE: Subject: Are there any easy-to-use Visual Studio C# WinForms-like GUI designers in the Python world for Tk?

2023-12-29 Thread Greg Walters via Python-list
> I'm used to C# WinForms, which has an easy-to-use drag-and-drop
GUI designer in Visual Studio. Is there anything similar for Tk? How
about Qt? What do you recommend as the easiest way to create GUI programs
in Python, similar to the ease of use of C# WinForms?

I can't say much for Qt other than there is a GUI designer for it, but I
don't know much about it.

As to the portion of your question about Python and Tkinter, YES!
The project is called PAGE and it is a drag and drop designer using the Tk
and ttk toolkits (basically Tkinter).

It's been around for many years, is completely FREE and open source, the
source code is included and works on Windows, Linux and Mac OS.

The current version is 7.6 and you can find it at
https://sourceforge.net/projects/page/ and it has been downloaded over 2000
times just in December, and over 26,000 times in 2023.

There is a TONNE of examples, full documentation and a number of
tutorials.  The Sourceforge acts as the main help site, but there is also a
Discord site dedicated to help and support.

I sincerely hope this helps!

Greg Walters


-- 
*My memory check bounced*



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


Re: Are there any easy-to-use Visual Studio C# WinForms-like GUI designers in the Python world for Tk?

2023-12-29 Thread Mats Wichmann via Python-list

On 12/28/23 18:05, Félix An via Python-list wrote:
I'm used to C# WinForms, which has an easy-to-use drag-and-drop GUI 
designer in Visual Studio. Is there anything similar for Tk? How about 
Qt? What do you recommend as the easiest way to create GUI programs in 
Python, similar to the ease of use of C# WinForms?


Qt has a long-standing Designer tool.

I was pretty sure there was nothing for tkinter, but it seems at least 
someone tried:


https://pypi.org/project/tkdesigner/

and someone has tried a web-based one (looks like it may help to read 
Chinese for that one)


https://visualtk.com/


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


Re: mypy question

2023-12-29 Thread Mats Wichmann via Python-list

On 12/29/23 08:02, Karsten Hilbert via Python-list wrote:


Dict[str, str] means the key type and value type should both be strings,


Indeed, I know that much, list[dict[str, str]] is what is getting
passed in in this particular invocation of run_rw_queries().

For what it's worth here's the signature of that function:

def run_rw_queries (
link_obj:_TLnkObj=None,
queries:list[dict[str, str | list | dict[str, Any]]]=None,
end_tx:bool=False,
return_data:bool=None,
get_col_idx:bool=False,
verbose:bool=False
) -> tuple[list[dbapi.extras.DictRow], dict[str, int] | None]:

Given that I would have thought that passing in
list[dict[str, str]] for "queries" ought to be type safe.
Mypy indicates otherwise which I am not grokking as to why.


ah... didn't grok what you were asking, sorry - ignore my attempt then. 
So you are passing something that has been typed more narrowly than the 
function parameter. Can you use a TypeGuard here?

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


Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Chris Angelico via Python-list
On Sat, 30 Dec 2023 at 01:37, Left Right  wrote:
>
> > Yeah, because you have the God-given RIGHT to be able to say anything
> > you like, on anyone's web site, and nobody's allowed to delete
> > anything you say! That's how it goes, right?
>
> I don't believe in god, and I don't believe he / she can give me
> rights.  What I believe in is that Python is a public good, and its
> status is enshrined in the license it uses.

Is it? I'm not a lawyer, but I really don't think that that's what the
license entitles you to. Can you quote the relevant parts of it?

> > Don't let the door hit you on the way out.
>
> Oh, great. Here we go again.  You don't even know what this discussion
> is about, but decided to be rude.

Oh trust me, I saw the discussion previously. I know what it is about.
And when it comes to rudeness, let's just say, you reap what you sow.

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


Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Left Right via Python-list
Previously you wrote:

> Here is the discussion referred to:
https://discuss.python.org/t/what-is-install-paths-to-in-wheel-file/42005

This illustrates you had no idea what the discussion was about and now
you write:

> Oh trust me, I saw the discussion previously.

Both cannot be true at the same time, unless you had some kind of very
brief memory loss.

> I'm not a lawyer,

Neither am I. All I have to work with is my understanding of the
English language.  Here's how I come to my conclusions.

The Python license grants all intellectual rights to Python to PSF (an
American NGO, a.k.a. 501(c) organization), which, essentially, can be
characterized as an organization for public good.

This is what it has to say about itself in its mission statement:

> Mission

> The mission of the Python Software Foundation is to promote, protect,
> and advance the Python programming language, and to support and
> facilitate the growth of a diverse and international community of Python
> programmers.

it also elaborates what it means by "diverse" as follows:

>

Diversity

> The Python Software Foundation and the global Python community
> welcome and encourage participation by everyone. Our community
> is based on mutual respect, tolerance, and encouragement, and we
> are working to help each other live up to these principles. We want
> our community to be more diverse: whoever you are, and whatever
> your background, we welcome you.

My understanding is that "welcome and encourage participation by
everyone" is in stark contradiction to banning someone disagreeing
with you.  Note, I haven't offended anyone.  I haven't even spoken to
anyone who found themselves being offended.  All I did was to describe
in some detail the reasons why some projects endorsed by PyPA are a
bad idea.  You, as well as anyone else, are welcome to believe
differently.  This is the whole point of diversity allegedly promoted
by PSF. I will think you are wrong, but it's not my place to shut you
up.  Neither is it the place of people in charge of the public
discussion of Python or its satellite projects.  They are not there to
decide who's right and who gets the stage. Their role is to preserve
the public good, which any discussion about subjects relevant to
Python would be.

What happens, however, and this is the unfortunate fate of popular
projects, is that a small group of people consolidate all means of
control in their hands, and the more control they get, the easier it
is to get even more of it.  The natural factor that would prevent this
from happening: the community dissatisfaction with their role becomes
increasingly less powerful as soon as more and more members of the
community come to depend on the good provided by the community.

If this discuss.python.org is representative of the Python community
as a whole, then, unfortunately, it means that the goals PSF set for
it are fading into the distance, rather than becoming more attainable.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Chris Angelico via Python-list
On Sat, 30 Dec 2023 at 06:58, Left Right  wrote:
> My understanding is that "welcome and encourage participation by
> everyone" is in stark contradiction to banning someone disagreeing
> with you.

Then your understanding is flat-out wrong. Encouraging participation
by everyone DOES mean deleting what is unproductive, offensive, and
likely to discourage participation.

Your entire argument is based on misconceptions. Go play in your own
sandbox somewhere, see if you can make something where everyone is
welcome, including the toxic AND the people who dislike toxicity.

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


Re: mypy question

2023-12-29 Thread Karsten Hilbert via Python-list
Am Fri, Dec 29, 2023 at 11:04:59AM -0700 schrieb Mats Wichmann via Python-list:

> >For what it's worth here's the signature of that function:
> >
> > def run_rw_queries (
> > link_obj:_TLnkObj=None,
> > queries:list[dict[str, str | list | dict[str, Any]]]=None,
> > end_tx:bool=False,
> > return_data:bool=None,
> > get_col_idx:bool=False,
> > verbose:bool=False
> > ) -> tuple[list[dbapi.extras.DictRow], dict[str, int] | None]:
> >
> >Given that I would have thought that passing in
> >list[dict[str, str]] for "queries" ought to be type safe.
> >Mypy indicates otherwise which I am not grokking as to why.
>
> ah... didn't grok what you were asking, sorry - ignore my attempt then.

Never mind, the attempt to help is appreciated.

> So you are passing something that has been typed more
> narrowly than the function parameter.

That would then sort of skirt on violation of the Liskov
principle, of which I learned while trying to research this
mypy behaviour.

However, I would not think the above to be a narrowing-down
as it just *selects* one of the explicitely "legal" options.

list[dict[str, str | list | dict[str, Any]]]

should AFAICT expand to:

list[dict[str, dict[str, Any]]]

OR

list[dict[str, list]]

OR

list[dict[str, str]]

the last of which should provide coverage of

[{'some key': 'some value'}]

> Can you use a TypeGuard here?

Not from what I understand about them...

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are there any easy-to-use Visual Studio C# WinForms-like GUI designers in the Python world for Tk?

2023-12-29 Thread Jach Feng via Python-list
Félix An 在 2023年12月29日 星期五下午2:05:24 [UTC+13] 的信中寫道:
> I'm used to C# WinForms, which has an easy-to-use drag-and-drop GUI 
> designer in Visual Studio. Is there anything similar for Tk? How about 
> Qt? What do you recommend as the easiest way to create GUI programs in 
> Python, similar to the ease of use of C# WinForms?
For tkinter, there is a GUI designer,
http://page.sourceforge.net/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Left Right via Python-list
> Then your understanding is flat-out wrong. Encouraging participation
> by everyone DOES mean deleting what is unproductive, offensive, and
> likely to discourage participation.

I haven't written anything unproductive or offensive. I offered
constructive criticism with a detailed plan on how to fix the problem.
The forum owners chose to ban me because they don't like hearing that
the code they've written is bad. And that's the long and the short of
it. This has been a pattern in behavior of PyPA members I've
interacted with so far.  And whenever they had a chance, they'd use it
to pretend that the problems I'm talking about don't exist by deleting
every mention of the problem. That is an example of unproductive and
offensive behavior because it produces nothing and wastes my time I've
dedicated to locating, reporting and solving their problem.

> Go play in your own sandbox somewhere,

You are being repeatedly rude, without provocation, and yet you keep
blaming me for what you are doing. I guess you have to be a moderator
in this forum because you act as if this is a kind of behavior will be
without any repercussions for you.

You probably don't understand it, but this sandbox is as much yours as
it is mine.  You can "become" an authority and, eg. block me -- but
that would be an overreach. Physically possible but morally wrong.

I don't need to prove you wrong by being better than you. Nobody does.
Being right or wrong isn't about being better at something.

Not only that, I legally (and physically) cannot establish my own
Python Software Foundation and claim a right to Python intellectual
property, establish a governing body for Python etc. These forums are
how PSF is supposed to implement its advertised policies.  I cannot
just take over them... that'd be illegal even if I somehow managed to
physically pull it off.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is Install-Paths-To in WHEEL file?

2023-12-29 Thread Oscar Benjamin via Python-list
On Fri, 29 Dec 2023 at 22:38, Left Right via Python-list
 wrote:
>
> > Then your understanding is flat-out wrong. Encouraging participation
> > by everyone DOES mean deleting what is unproductive, offensive, and
> > likely to discourage participation.
>
> I haven't written anything unproductive or offensive. I offered
> constructive criticism with a detailed plan on how to fix the problem.
> The forum owners chose to ban me because they don't like hearing that
> the code they've written is bad. And that's the long and the short of
> it. This has been a pattern in behavior of PyPA members I've
> interacted with so far.

You are conflating several different groups of people. The PyPA are
the people who currently maintain the code for various
libraries/tools. That is very often not the same as the people who
originally wrote the code for the same libraries/tools or for
preceding ones. Neither group is the same as the forum moderators (I
suspect that there is no intersection between the moderators and the
PyPA etc.).

> And whenever they had a chance, they'd use it
> to pretend that the problems I'm talking about don't exist by deleting
> every mention of the problem. That is an example of unproductive and
> offensive behavior because it produces nothing and wastes my time I've
> dedicated to locating, reporting and solving their problem.

Actually you are wasting the time of others by putting across
inaccurate and unhelpful information in a rude way and at the same
time criticising others without really understanding who you are
criticising and for what. Your contribution is unhelpful mostly (but
not exclusively) because of the way that you choose to communicate.

I did not realise earlier what you were referring to but I see now
that I have email notifications with the content of your posts that
were deleted. I am not surprised that they were deleted and that you
were banned because if I was a moderator looking at those then I would
not expect a promising future for your interactions with others in the
forum.

There is some significant irony in you describing the forum as a
"toxic pit" for deleting your posts. I don't always agree with the
moderators and I am not sure that I would have reacted the way that
they did but these threads remind me precisely why moderation
(including deleting posts such as yours) is needed to *prevent* a
forum from turning into a toxic pit.

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


Re: mypy question

2023-12-29 Thread Greg Ewing via Python-list

On 30/12/23 4:02 am, Karsten Hilbert wrote:


def run_rw_queries (
link_obj:_TLnkObj=None,
queries:list[dict[str, str | list | dict[str, Any]]]=None,



Given that I would have thought that passing in
list[dict[str, str]] for "queries" ought to be type safe.


dict[str, str] is not a subtype of dict[str, str | something_else]
because you can assign a value of type something_else to the latter
but not the former.

In this case it happens to be okay because the function is (presumably)
treating the dict passed in as immutable, but MyPy has no way to be sure
of that.

You could try declaring it as a collections.Mapping, which is immutable.

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


Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-29 Thread Mike Dewhirst via Python-list

On 29/12/2023 12:09 pm, Félix An via Python-list wrote:

On 2023-12-25 12:36, Mike Dewhirst wrote:


3. You cannot trust Microsoft. You can trust Python Software 
Foundation. Python from PSF works the same in all environments - or 
if not it is a bug. Python from Microsoft is tweaked to satisfy their 
aforementioned strategy of locking in users to Windows.




I strongly disagree with this.


Not sure which part of the above you strongly disagree with. I might 
seem a bit OTT with "You cannot trust Microsoft" but I did put it in a 
specific context.


PSF does try to make Python work identically in all operating systems it 
supports. The OP was using py.exe which I discovered (just now - and it 
is why I'm writing this) exists on my Windows 10 machine. I have never 
installed any Python other than personally downloaded from the 
python.org website - therefore py.exe must have come from PSF!


I had assumed the OP had installed Python from the Microsoft shop and 
that's where py.exe must have come from.


I learn something every day.

I don't get all the irrational hate for Microsoft that exists within 
the Linux community.


Perhaps you are too young to remember when Steve Ballmer was head of 
Microsoft?


He specifically and loudly hated Linux and developed the anti-linux 
culture/strategy within Microsoft. If memory serves correctly he called 
it a virus. That was in the context of trying to get rid of Linux in 
Europe (Germany I think) where it had gained a small municipal foothold. 
Microsoft eventually succeeded in reversing that public mistake.


In recent years, Microsoft has made great contributions to the 
everyday life of Linux users. VS Code is based on open source and 
available on Linux, .NET is now on Linux, Windows has WSL2 and Visual 
Studio Linux development tools to help you develop software for Linux, 
SQL Server (despite still being commercial software except for the 
Express and Developer versions) is on Linux, etc.


I only use Linux on servers without GUI. I have used Windows desktop 
since it was released because most of my clients used it. I had no 
choice. I have been watching what they do for decades.


I agree they appear to have become more civilised in recent years.

M

--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Your
email software can handle signing.



OpenPGP_signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-29 Thread Chris Angelico via Python-list
On Sat, 30 Dec 2023 at 14:06, Mike Dewhirst via Python-list
 wrote:
>
> On 29/12/2023 12:09 pm, Félix An via Python-list wrote:
> > On 2023-12-25 12:36, Mike Dewhirst wrote:
> >>
> >> 3. You cannot trust Microsoft. You can trust Python Software
> >> Foundation. Python from PSF works the same in all environments - or
> >> if not it is a bug. Python from Microsoft is tweaked to satisfy their
> >> aforementioned strategy of locking in users to Windows.
> >>
> >
> > I strongly disagree with this.
>
> Not sure which part of the above you strongly disagree with. I might
> seem a bit OTT with "You cannot trust Microsoft" but I did put it in a
> specific context.
>
> PSF does try to make Python work identically in all operating systems it
> supports. The OP was using py.exe which I discovered (just now - and it
> is why I'm writing this) exists on my Windows 10 machine. I have never
> installed any Python other than personally downloaded from the
> python.org website - therefore py.exe must have come from PSF!
>
> I had assumed the OP had installed Python from the Microsoft shop and
> that's where py.exe must have come from.
>
> I learn something every day.

If you'd done a little research, you might have found this:

https://peps.python.org/pep-0397/

Yes, it is from the official launcher. I don't see why you'd expect
Microsoft to go to the effort of building their own launcher when it
can be available for every Python user.

> > I don't get all the irrational hate for Microsoft that exists within
> > the Linux community.
>
> Perhaps you are too young to remember when Steve Ballmer was head of
> Microsoft?

How relevant is this?

I remember the days when OS/2 was the big target, and Microsoft was
the greatest anti-OS/2 voice out there. Does that affect the way I use
tools today? Is it even slightly relevant?

I remember when Intel had floating-point division issues in their
FPUs. Do I tell people "don't do floating-point math on Intel
processors"? Is it relevant?

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