Re: on a tail-recursive square-and-multiply

2023-11-07 Thread Greg Ewing via Python-list

On 8/11/23 2:26 pm, Julieta Shem wrote:

For the first time I'm trying to write a tail-recursive
square-and-multiply and, even though it /seems/ to work, I'm not happy
with what I wrote and I don't seem to understand it so well.


Stepping back a bit, why do you feel the need to write this
tail-recursively? Is it just an exercise?

Note that Python doesn't optimise tail calls, so anything that
can be done tail-recursively is probably better done iteratively.



--8<---cut here---start->8---
def sam(b, e, m, acc = 1):
   if e == 0:
 return acc
   if is_even(e):
 return sam(remainder(b * b, m), e//2, m, acc)
   else:
 return sam(b, e - 1, m, remainder(b * acc, m))
--8<---cut here---end--->8---

You see, I tried to use an accumulator, but I'm only accumulating when
the exponent is odd.  When it's even, I feel I'm forced to change the
base into b * b mod m and leave the accumulator alone.  This feels so
unnatural to me.  I feel I broke some symmetry there.  I'm having to
think of two cases --- when I change the accumulator and when I change
the base.  That seems too much for my small head.  Can you help?


Well, there are inherently two cases, and they're different, so
I don't think you're doing anything wrong here. It was asymmetrical
to begin with. If you were doing it iteratively you would also be
leaving the accumulator alone when the exponent is even.

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


Re: on a tail-recursive square-and-multiply

2023-11-07 Thread Michael Torrie via Python-list
On 11/7/23 18:26, Julieta Shem via Python-list wrote:
> For the first time I'm trying to write a tail-recursive
> square-and-multiply and, even though it /seems/ to work, I'm not happy
> with what I wrote and I don't seem to understand it so well.
> 
> --8<---cut here---start->8---
> def sam(b, e, m, acc = 1):
>   if e == 0:
> return acc
>   if is_even(e):
> return sam(remainder(b * b, m), e//2, m, acc)
>   else:
> return sam(b, e - 1, m, remainder(b * acc, m))
> --8<---cut here---end--->8---

I don't see any definition of "remainder()"  When you post to the list,
please provide short but complete code, including a demonstration of
using the code provided. That will help others understand what you are
trying to do, and perhaps comment on your concerns.

> You see, I tried to use an accumulator, but I'm only accumulating when
> the exponent is odd.  When it's even, I feel I'm forced to change the
> base into b * b mod m and leave the accumulator alone.  This feels so
> unnatural to me.  I feel I broke some symmetry there.  I'm having to
> think of two cases --- when I change the accumulator and when I change
> the base.  That seems too much for my small head.  Can you help?

I don't really understand the code either, so I cannot help much.

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


on a tail-recursive square-and-multiply

2023-11-07 Thread Julieta Shem via Python-list
For the first time I'm trying to write a tail-recursive
square-and-multiply and, even though it /seems/ to work, I'm not happy
with what I wrote and I don't seem to understand it so well.

--8<---cut here---start->8---
def sam(b, e, m, acc = 1):
  if e == 0:
return acc
  if is_even(e):
return sam(remainder(b * b, m), e//2, m, acc)
  else:
return sam(b, e - 1, m, remainder(b * acc, m))
--8<---cut here---end--->8---

You see, I tried to use an accumulator, but I'm only accumulating when
the exponent is odd.  When it's even, I feel I'm forced to change the
base into b * b mod m and leave the accumulator alone.  This feels so
unnatural to me.  I feel I broke some symmetry there.  I'm having to
think of two cases --- when I change the accumulator and when I change
the base.  That seems too much for my small head.  Can you help?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help

2023-11-07 Thread Mike Dewhirst via Python-list

On 7/11/2023 9:02 am, Jason Friedman via Python-list wrote:

On Sun, Nov 5, 2023 at 1:23 PM office officce via Python-list <
python-list@python.org> wrote:


which python version is better to be used and how to make sure it works on
my window 10 because i downloaded it and it never worked so I uninstall to
do that again please can you give me the steps on how it will work perfectly


1. Download from https://python.org (not Microsoft) and always choose 
the 64-bit stable version


2. Choose the installation location as C:\Python311 (avoid the default)

4. Accept other recommended installation options especially to include 
Python on the path (if offered)


Guaranteed to work. Also, you will never have to uninstall. Install the 
next version in C:\Python312 etc


In due course, investigate virtual environments so you can work on 
projects simultaneously using different versions of Python or different 
versions of various Python libraries.


Good luck

Mike





If you are just starting out, the most recent version is 3.12 and is
probably your best choice.

When you say it never worked, can you describe in more detail what you did
and what error messages you encountered?

This mailing list does not accept screenshots.



--
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: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Greg Ewing via Python-list

On 8/11/23 8:10 am, MRAB wrote:

Something to do with how scoping is implemented in comprehensions?


Yes, together with the way class scopes work during class construction.

Behind the scenes, the body of a listcomp happens to be implemented
as a nested function.

Usually you don't notice this, but while a class is being built,
its scope doesn't count as an enlosing scope for functions defined
within the class.

This is necessary, otherwise all of a class's attributes would be 
visible inside its methods, which isn't what we want. However, it

leads to some odd corner cases, such as this one.

There are various ways you could work around this. I would suggest
moving the offending code outside the class and qualifying the
constants it uses with the class name.

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


Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread MRAB via Python-list

On 2023-11-07 20:56, Thomas Passin via Python-list wrote:

On 11/7/2023 3:29 PM, MRAB via Python-list wrote:

On 2023-11-07 19:20, Jim Schwartz via Python-list wrote:
Where do you define fCONV_AUSRICHTG? It must be initialized or defined 
somewhere. Did you leave out a statement from the python 2 version?



It's given its value here:

     (
     fNAME,
     fLG1,
     fLG2,
     fTYP,
     fCONV_AUSRICHTG,
     fENTRY_AUSRICHTG,
     fTEXT_AUSRICHTUNG,
     fHOLFUNKT,
     fPRUEFFUNKT,
     fPRUEF_ARG,
     ) = list(range(10))



This construction is a sneaky way to assign index numbers to list
entries.  A simplified example:

  >>> S1 = 'string 1'
  >>> S2 = 'string 2'
  >>> (fS1, fS2) = list(range(2))
  >>> fS1
0
  >>>
  >>> fS2
1


You don't need the 'list', though: range(...) will work on its own.

[snip]

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


Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Thomas Passin via Python-list

On 11/7/2023 3:29 PM, MRAB via Python-list wrote:

On 2023-11-07 19:20, Jim Schwartz via Python-list wrote:
Where do you define fCONV_AUSRICHTG? It must be initialized or defined 
somewhere. Did you leave out a statement from the python 2 version?



It's given its value here:

     (
     fNAME,
     fLG1,
     fLG2,
     fTYP,
     fCONV_AUSRICHTG,
     fENTRY_AUSRICHTG,
     fTEXT_AUSRICHTUNG,
     fHOLFUNKT,
     fPRUEFFUNKT,
     fPRUEF_ARG,
     ) = list(range(10))



This construction is a sneaky way to assign index numbers to list 
entries.  A simplified example:


>>> S1 = 'string 1'
>>> S2 = 'string 2'
>>> (fS1, fS2) = list(range(2))
>>> fS1
0
>>>
>>> fS2
1





On Nov 7, 2023, at 1:06 PM, Thomas Passin via Python-list 
 wrote:


On 11/7/2023 12:47 PM, Egon Frerich via Python-list wrote:
I've no idea why this happens. In a module there are lists and 
definitions:

    Felder = [
    # Name   lg1  lg2 typ   Ausrichtung Holen Prüfen Prüfvorg
    ["Jahr", 4, 5, "u", "", "right", "center"],
    ["Monat", 2, 5, "u", "", "right", "center"],
    ["Tag", 2, 3, "u", "", "right", "center"],
    ["Belegnr", 5, 7, "s", "", "right", "center"],
    ["Bank", 2, 4, "u", "", "center", "center"],
    ["Art", 2, 3, "u", "", "center", "center"],
    ["Aufg", 2, 4, "u", "", "center", "center"],
    ["Text", 25, 25, "s", "-", "left", "left"],
    ["Ergänzung", 12, 12, "s", "-", "left", "left"],
    ["Betrag", 13, 13, "s", "", "right", "right"],
    ["W", 1, 2, "s", "", "center", "center"],
    ["WBetrag", 7, 7, "s", "", "right", "right"],
    ["Kurs", 6, 6, "s", "", "right", "right"],
    ]
    "Reihenfolge in der Dimension 1"
    (
    fJAHR,
    fMONAT,
    fTAG,
    fBELEGNR,
    fBANK,
    fART,
    fAUFGABE,
    fTEXT,
    fTEXTERG,
    fBETRAG,
    fWAEHRUNG,
    fBETRAGinWAEHRUNG,
    fUMRECHNUNGSKURS,
    ) = list(range(13))
    "Reihenfolge in der Dimension 2"
    (
    fNAME,
    fLG1,
    fLG2,
    fTYP,
    fCONV_AUSRICHTG,
    fENTRY_AUSRICHTG,
    fTEXT_AUSRICHTUNG,
    fHOLFUNKT,
    fPRUEFFUNKT,
    fPRUEF_ARG,
    ) = list(range(10))
Two lines with  test statements follow and the statement which 
produces an error:

    print(Felder)
    print(fJAHR, fNAME, fTYP, fCONV_AUSRICHTG)
    akette = "%" + "%".join(
    ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in 
Felder])

The traceback shows:
$ python3 testGeldspurGUI.py
[['Jahr', 4, 5, 'u', '', 'right', 'center'], ['Monat', 2, 5, 'u', 
'', 'right', 'center'], ['Tag', 2, 3, 'u', '', 'right', 'center'], 
['Belegnr', 5, 7, 's', '', 'right', 'center'], ['Bank', 2, 4, 'u', 
'', 'center', 'center'], ['Art', 2, 3, 'u', '', 'center', 'center'], 
['Aufg', 2, 4, 'u', '', 'center', 'center'], ['Text', 25, 25, 's', 
'-', 'left', 'left'], ['Ergänzung', 12, 12, 's', '-', 'left', 
'left'], ['Betrag', 13, 13, 's', '', 'right', 'right'], ['W', 1, 2, 
's', '', 'center', 'center'], ['WBetrag', 7, 7, 's', '', 'right', 
'right'], ['Kurs', 6, 6, 's', '', 'right', 'right']]

0 0 3 4
Traceback (most recent call last):
  File "/home/egon/Entw/Geldspur/geldspur/testGeldspurGUI.py", line 
15, in 

    from tests.testU2 import testU2
  File "/home/egon/Entw/Geldspur/geldspur/tests/testU2.py", line 9, 
in 

    from gui.GUI_Konfig import GUIcfg
  File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 
11, in 

    class GUIcfg:
  File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 
90, in GUIcfg
    ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in 
Felder])
  File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 
90, in 
    ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in 
Felder])

NameError: name 'fCONV_AUSRICHTG' is not defined
You see "Felder" and with "0 0 3 4" the correct value 4 for 
fCONV_AUSRICHTG. But there is the NameError.

What does  mean? Is there a change from python2 to python3?


You are using a syntax that I don't understand, but "listcomp" means 
a list comprehenson.






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


Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread MRAB via Python-list

On 2023-11-07 19:20, Jim Schwartz via Python-list wrote:

Where do you define fCONV_AUSRICHTG? It must be initialized or defined 
somewhere. Did you leave out a statement from the python 2 version?


It's given its value here:

(
fNAME,
fLG1,
fLG2,
fTYP,
fCONV_AUSRICHTG,
fENTRY_AUSRICHTG,
fTEXT_AUSRICHTUNG,
fHOLFUNKT,
fPRUEFFUNKT,
fPRUEF_ARG,
) = list(range(10))




On Nov 7, 2023, at 1:06 PM, Thomas Passin via Python-list 
 wrote:

On 11/7/2023 12:47 PM, Egon Frerich via Python-list wrote:

I've no idea why this happens. In a module there are lists and definitions:
Felder = [
# Name   lg1  lg2 typ   Ausrichtung Holen Prüfen Prüfvorg
["Jahr", 4, 5, "u", "", "right", "center"],
["Monat", 2, 5, "u", "", "right", "center"],
["Tag", 2, 3, "u", "", "right", "center"],
["Belegnr", 5, 7, "s", "", "right", "center"],
["Bank", 2, 4, "u", "", "center", "center"],
["Art", 2, 3, "u", "", "center", "center"],
["Aufg", 2, 4, "u", "", "center", "center"],
["Text", 25, 25, "s", "-", "left", "left"],
["Ergänzung", 12, 12, "s", "-", "left", "left"],
["Betrag", 13, 13, "s", "", "right", "right"],
["W", 1, 2, "s", "", "center", "center"],
["WBetrag", 7, 7, "s", "", "right", "right"],
["Kurs", 6, 6, "s", "", "right", "right"],
]
"Reihenfolge in der Dimension 1"
(
fJAHR,
fMONAT,
fTAG,
fBELEGNR,
fBANK,
fART,
fAUFGABE,
fTEXT,
fTEXTERG,
fBETRAG,
fWAEHRUNG,
fBETRAGinWAEHRUNG,
fUMRECHNUNGSKURS,
) = list(range(13))
"Reihenfolge in der Dimension 2"
(
fNAME,
fLG1,
fLG2,
fTYP,
fCONV_AUSRICHTG,
fENTRY_AUSRICHTG,
fTEXT_AUSRICHTUNG,
fHOLFUNKT,
fPRUEFFUNKT,
fPRUEF_ARG,
) = list(range(10))
Two lines with  test statements follow and the statement which produces an 
error:
print(Felder)
print(fJAHR, fNAME, fTYP, fCONV_AUSRICHTG)
akette = "%" + "%".join(
["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
The traceback shows:
$ python3 testGeldspurGUI.py
[['Jahr', 4, 5, 'u', '', 'right', 'center'], ['Monat', 2, 5, 'u', '', 'right', 
'center'], ['Tag', 2, 3, 'u', '', 'right', 'center'], ['Belegnr', 5, 7, 's', 
'', 'right', 'center'], ['Bank', 2, 4, 'u', '', 'center', 'center'], ['Art', 2, 
3, 'u', '', 'center', 'center'], ['Aufg', 2, 4, 'u', '', 'center', 'center'], 
['Text', 25, 25, 's', '-', 'left', 'left'], ['Ergänzung', 12, 12, 's', '-', 
'left', 'left'], ['Betrag', 13, 13, 's', '', 'right', 'right'], ['W', 1, 2, 
's', '', 'center', 'center'], ['WBetrag', 7, 7, 's', '', 'right', 'right'], 
['Kurs', 6, 6, 's', '', 'right', 'right']]
0 0 3 4
Traceback (most recent call last):
  File "/home/egon/Entw/Geldspur/geldspur/testGeldspurGUI.py", line 15, in 

from tests.testU2 import testU2
  File "/home/egon/Entw/Geldspur/geldspur/tests/testU2.py", line 9, in 
from gui.GUI_Konfig import GUIcfg
  File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 11, in 

class GUIcfg:
  File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, in GUIcfg
["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
  File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, in 

["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
NameError: name 'fCONV_AUSRICHTG' is not defined
You see "Felder" and with "0 0 3 4" the correct value 4 for fCONV_AUSRICHTG. 
But there is the NameError.
What does  mean? Is there a change from python2 to python3?


You are using a syntax that I don't understand, but "listcomp" means a list 
comprehenson.



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


Clearing the Deque • Picturing Python’s `deque` data structure

2023-11-07 Thread dn via Python-list
You will be welcome to join us at our next (hybrid) meeting: Wednesday, 
15 November 2023, 1815~2030 NZDT (0515~0730 UTC).



How often do you use a deque*? “Not very” is a common answer. Perhaps 
you’ve never used it. In this presentation, Stephen won’t try to 
convince you to use it more often. Instead, he’ll present a different 
perspective on what this data structure is, and how it differs from a 
list. The presentation will compare deques and lists in a visual manner, 
to help us understand why we may need a deque in certain situations. 
We’ll also explore some demonstration examples to highlight the 
differences in performance between the two data structures in different 
scenarios.

*pronounced like “deck"

Audience: This presentation is ideal for those who have either never 
heard of deque, or have heard of it but never really used it or 
understood why it’s needed. The more experienced may find the visual 
story insightful.


Stephen used to be a physicist, which is where he learned programming. 
After working in science and academia for over a decade, he decided to 
escape before it was too late. Since then, has focused exclusively on 
teaching coding and communicating about Python. A big part of his day is 
busy with running Codetoday—we teach Python coding to children between 7 
and 16 years old (https://www.codetoday.co.uk/). He also runs courses 
for adults and corporate training programs, and particularly, writing 
about Python. He writes the articles he wished he had when learning. He 
publishes articles at The Python Coding Stack 
(https://thepythoncodingstack.substack.com/) and also wrote an online 
book (soon to be in other formats, too) for beginners, The Python Coding 
Book (https://thepythoncodingbook.com/).



Please RSVP on Meetup.com (NZPUG Auckland Branch): 
https://www.meetup.com/nzpug-auckland/events/295433874/


--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Golf

2023-11-07 Thread Jon Ribbens via Python-list
On 2023-11-07,   wrote:
> Discussions like this feel a bit silly after a while. How long
> something is to type on a command line is not a major issue and
> brevity can lead to being hard to remember too especially using
> obscure references.

Of course it's silly, that's why it's called "golf"!

It would be basically insane to use open(0) instead of sys.stdin
like this except where the length of the source code overrides
all other considerations - which is essentially never, unless
playing code golf...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Jim Schwartz via Python-list
Where do you define fCONV_AUSRICHTG? It must be initialized or defined 
somewhere. Did you leave out a statement from the python 2 version?  

Sent from my iPhone

> On Nov 7, 2023, at 1:06 PM, Thomas Passin via Python-list 
>  wrote:
> 
> On 11/7/2023 12:47 PM, Egon Frerich via Python-list wrote:
>> I've no idea why this happens. In a module there are lists and definitions:
>> Felder = [
>> # Name   lg1  lg2 typ   Ausrichtung Holen Prüfen Prüfvorg
>> ["Jahr", 4, 5, "u", "", "right", "center"],
>> ["Monat", 2, 5, "u", "", "right", "center"],
>> ["Tag", 2, 3, "u", "", "right", "center"],
>> ["Belegnr", 5, 7, "s", "", "right", "center"],
>> ["Bank", 2, 4, "u", "", "center", "center"],
>> ["Art", 2, 3, "u", "", "center", "center"],
>> ["Aufg", 2, 4, "u", "", "center", "center"],
>> ["Text", 25, 25, "s", "-", "left", "left"],
>> ["Ergänzung", 12, 12, "s", "-", "left", "left"],
>> ["Betrag", 13, 13, "s", "", "right", "right"],
>> ["W", 1, 2, "s", "", "center", "center"],
>> ["WBetrag", 7, 7, "s", "", "right", "right"],
>> ["Kurs", 6, 6, "s", "", "right", "right"],
>> ]
>> "Reihenfolge in der Dimension 1"
>> (
>> fJAHR,
>> fMONAT,
>> fTAG,
>> fBELEGNR,
>> fBANK,
>> fART,
>> fAUFGABE,
>> fTEXT,
>> fTEXTERG,
>> fBETRAG,
>> fWAEHRUNG,
>> fBETRAGinWAEHRUNG,
>> fUMRECHNUNGSKURS,
>> ) = list(range(13))
>> "Reihenfolge in der Dimension 2"
>> (
>> fNAME,
>> fLG1,
>> fLG2,
>> fTYP,
>> fCONV_AUSRICHTG,
>> fENTRY_AUSRICHTG,
>> fTEXT_AUSRICHTUNG,
>> fHOLFUNKT,
>> fPRUEFFUNKT,
>> fPRUEF_ARG,
>> ) = list(range(10))
>> Two lines with  test statements follow and the statement which produces an 
>> error:
>> print(Felder)
>> print(fJAHR, fNAME, fTYP, fCONV_AUSRICHTG)
>> akette = "%" + "%".join(
>> ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
>> The traceback shows:
>> $ python3 testGeldspurGUI.py
>> [['Jahr', 4, 5, 'u', '', 'right', 'center'], ['Monat', 2, 5, 'u', '', 
>> 'right', 'center'], ['Tag', 2, 3, 'u', '', 'right', 'center'], ['Belegnr', 
>> 5, 7, 's', '', 'right', 'center'], ['Bank', 2, 4, 'u', '', 'center', 
>> 'center'], ['Art', 2, 3, 'u', '', 'center', 'center'], ['Aufg', 2, 4, 'u', 
>> '', 'center', 'center'], ['Text', 25, 25, 's', '-', 'left', 'left'], 
>> ['Ergänzung', 12, 12, 's', '-', 'left', 'left'], ['Betrag', 13, 13, 's', '', 
>> 'right', 'right'], ['W', 1, 2, 's', '', 'center', 'center'], ['WBetrag', 7, 
>> 7, 's', '', 'right', 'right'], ['Kurs', 6, 6, 's', '', 'right', 'right']]
>> 0 0 3 4
>> Traceback (most recent call last):
>>   File "/home/egon/Entw/Geldspur/geldspur/testGeldspurGUI.py", line 15, in 
>> 
>> from tests.testU2 import testU2
>>   File "/home/egon/Entw/Geldspur/geldspur/tests/testU2.py", line 9, in 
>> 
>> from gui.GUI_Konfig import GUIcfg
>>   File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 11, in 
>> 
>> class GUIcfg:
>>   File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, in 
>> GUIcfg
>> ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
>>   File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, in 
>> 
>> ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
>> NameError: name 'fCONV_AUSRICHTG' is not defined
>> You see "Felder" and with "0 0 3 4" the correct value 4 for fCONV_AUSRICHTG. 
>> But there is the NameError.
>> What does  mean? Is there a change from python2 to python3?
> 
> You are using a syntax that I don't understand, but "listcomp" means a list 
> comprehenson.
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread MRAB via Python-list

On 2023-11-07 18:30, dn via Python-list wrote:

On 08/11/2023 06.47, Egon Frerich via Python-list wrote:

I've no idea why this happens. In a module there are lists and definitions:

...


     ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
   File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, 
in 

     ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
NameError: name 'fCONV_AUSRICHTG' is not defined

You see "Felder" and with "0 0 3 4" the correct value 4 for 
fCONV_AUSRICHTG. But there is the NameError.


What does  mean? Is there a change from python2 to python3?


Works for me (Python 3.11 on Fedora-Linux 37)
- both as a script, and simple/single import.

What happens when you extract the second dimension's definitions into a
module of their own, and import that (with/out less-sophisticated join)?


The missing detail is this line from the traceback:

   File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 11,
in 
 class GUIcfg:

Here's a small example that shows the problem:

8<
#!python3.11
# -*- encoding: utf-8 -*-

class Test:
hello = "hello"
print(hello)
print([[zero] for _ in range(4)])
8<

and its traceback:

8<
hello
Traceback (most recent call last):
  File "C:\Projects\regex3\test_clipboard.py", line 4, in 
class Test:
  File "C:\Projects\regex3\test_clipboard.py", line 7, in Test
print([zero for _ in range(4)])
 ^^
  File "C:\Projects\regex3\test_clipboard.py", line 7, in 
print([zero for _ in range(4)])
   
NameError: name 'zero' is not defined
8<

'zero' is visible in:

print(hello)

but not in:

print([zero for _ in range(4)])

Something to do with how scoping is implemented in comprehensions?

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


Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Thomas Passin via Python-list

On 11/7/2023 12:47 PM, Egon Frerich via Python-list wrote:

I've no idea why this happens. In a module there are lists and definitions:

     Felder = [
     # Name   lg1  lg2 typ   Ausrichtung Holen Prüfen Prüfvorg
     ["Jahr", 4, 5, "u", "", "right", "center"],
     ["Monat", 2, 5, "u", "", "right", "center"],
     ["Tag", 2, 3, "u", "", "right", "center"],
     ["Belegnr", 5, 7, "s", "", "right", "center"],
     ["Bank", 2, 4, "u", "", "center", "center"],
     ["Art", 2, 3, "u", "", "center", "center"],
     ["Aufg", 2, 4, "u", "", "center", "center"],
     ["Text", 25, 25, "s", "-", "left", "left"],
     ["Ergänzung", 12, 12, "s", "-", "left", "left"],
     ["Betrag", 13, 13, "s", "", "right", "right"],
     ["W", 1, 2, "s", "", "center", "center"],
     ["WBetrag", 7, 7, "s", "", "right", "right"],
     ["Kurs", 6, 6, "s", "", "right", "right"],
     ]
     "Reihenfolge in der Dimension 1"
     (
     fJAHR,
     fMONAT,
     fTAG,
     fBELEGNR,
     fBANK,
     fART,
     fAUFGABE,
     fTEXT,
     fTEXTERG,
     fBETRAG,
     fWAEHRUNG,
     fBETRAGinWAEHRUNG,
     fUMRECHNUNGSKURS,
     ) = list(range(13))
     "Reihenfolge in der Dimension 2"
     (
     fNAME,
     fLG1,
     fLG2,
     fTYP,
     fCONV_AUSRICHTG,
     fENTRY_AUSRICHTG,
     fTEXT_AUSRICHTUNG,
     fHOLFUNKT,
     fPRUEFFUNKT,
     fPRUEF_ARG,
     ) = list(range(10))


Two lines with  test statements follow and the statement which produces 
an error:


     print(Felder)
     print(fJAHR, fNAME, fTYP, fCONV_AUSRICHTG)
     akette = "%" + "%".join(
     ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in 
Felder])


The traceback shows:

$ python3 testGeldspurGUI.py
[['Jahr', 4, 5, 'u', '', 'right', 'center'], ['Monat', 2, 5, 'u', '', 
'right', 'center'], ['Tag', 2, 3, 'u', '', 'right', 'center'], 
['Belegnr', 5, 7, 's', '', 'right', 'center'], ['Bank', 2, 4, 'u', '', 
'center', 'center'], ['Art', 2, 3, 'u', '', 'center', 'center'], 
['Aufg', 2, 4, 'u', '', 'center', 'center'], ['Text', 25, 25, 's', '-', 
'left', 'left'], ['Ergänzung', 12, 12, 's', '-', 'left', 'left'], 
['Betrag', 13, 13, 's', '', 'right', 'right'], ['W', 1, 2, 's', '', 
'center', 'center'], ['WBetrag', 7, 7, 's', '', 'right', 'right'], 
['Kurs', 6, 6, 's', '', 'right', 'right']]

0 0 3 4
Traceback (most recent call last):
   File "/home/egon/Entw/Geldspur/geldspur/testGeldspurGUI.py", line 15, 
in 

     from tests.testU2 import testU2
   File "/home/egon/Entw/Geldspur/geldspur/tests/testU2.py", line 9, in 


     from gui.GUI_Konfig import GUIcfg
   File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 11, 
in 

     class GUIcfg:
   File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, 
in GUIcfg

     ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
   File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, 
in 

     ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
NameError: name 'fCONV_AUSRICHTG' is not defined

You see "Felder" and with "0 0 3 4" the correct value 4 for 
fCONV_AUSRICHTG. But there is the NameError.


What does  mean? Is there a change from python2 to python3?


You are using a syntax that I don't understand, but "listcomp" means a 
list comprehenson.


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


RE: Writing to clipboard in Python 3.11

2023-11-07 Thread Jim Schwartz via Python-list
It doesn't work in python 3.12.0

-Original Message-
From: Python-list  On 
Behalf Of Thomas Passin via Python-list
Sent: Tuesday, November 7, 2023 12:08 PM
To: python-list@python.org
Subject: Re: Writing to clipboard in Python 3.11

On 11/5/2023 7:51 PM, Rob Cliffe via Python-list wrote:
> Recently I switched from Python 3.8.3 to Python 3.11.4.  A strange 
> problem appeared which was not there before:
> I am using the win32clipboard backage (part of pywin32), and when I 
> use
> SetClipboardData() to write text which consists ENTIRELY OF DIGITS to 
> the clipboard, I either get an error (not always the same error 
> message) or a program crash.  The problem does not appear if I use
> SetClipboardText() instead.
> Sample program:
> 
> from win32clipboard import *
> OpenClipboard()
> SetClipboardData(CF_UNICODETEXT, "A")
> SetClipboardData(CF_UNICODETEXT, "A0") 
> SetClipboardData(CF_UNICODETEXT, "0A") SetClipboardText("0", 
> CF_UNICODETEXT) print("OK so far") SetClipboardData(CF_UNICODETEXT, 
> "0")
> CloseClipboard()
> 
> Sample output:
> 
> OK so far
> Traceback (most recent call last):
>File "R:\W.PY", line 8, in 
>  SetClipboardData(CF_UNICODETEXT, "0")
> pywintypes.error: (0, 'SetClipboardData', 'No error message is 
> available')
> 
> I can get round the problem by using SetClipboardText().  But can 
> anyone shed light on this?

No, but I use pyperclip.  It's cross platform.  Maybe it doesn't have this 
problem, though I don't know for sure.

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

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


Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread dn via Python-list

On 08/11/2023 06.47, Egon Frerich via Python-list wrote:

I've no idea why this happens. In a module there are lists and definitions:

...


     ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
   File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, 
in 

     ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
NameError: name 'fCONV_AUSRICHTG' is not defined

You see "Felder" and with "0 0 3 4" the correct value 4 for 
fCONV_AUSRICHTG. But there is the NameError.


What does  mean? Is there a change from python2 to python3?


Works for me (Python 3.11 on Fedora-Linux 37)
- both as a script, and simple/single import.

What happens when you extract the second dimension's definitions into a 
module of their own, and import that (with/out less-sophisticated join)?


--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Writing to clipboard in Python 3.11

2023-11-07 Thread Thomas Passin via Python-list

On 11/5/2023 7:51 PM, Rob Cliffe via Python-list wrote:
Recently I switched from Python 3.8.3 to Python 3.11.4.  A strange 
problem appeared which was not there before:
I am using the win32clipboard backage (part of pywin32), and when I use 
SetClipboardData() to write text which consists ENTIRELY OF DIGITS to 
the clipboard, I either get an error (not always the same error message) 
or a program crash.  The problem does not appear if I use 
SetClipboardText() instead.

Sample program:

from win32clipboard import *
OpenClipboard()
SetClipboardData(CF_UNICODETEXT, "A")
SetClipboardData(CF_UNICODETEXT, "A0")
SetClipboardData(CF_UNICODETEXT, "0A")
SetClipboardText("0", CF_UNICODETEXT)
print("OK so far")
SetClipboardData(CF_UNICODETEXT, "0")
CloseClipboard()

Sample output:

OK so far
Traceback (most recent call last):
   File "R:\W.PY", line 8, in 
     SetClipboardData(CF_UNICODETEXT, "0")
pywintypes.error: (0, 'SetClipboardData', 'No error message is available')

I can get round the problem by using SetClipboardText().  But can anyone 
shed light on this?


No, but I use pyperclip.  It's cross platform.  Maybe it doesn't have 
this problem, though I don't know for sure.


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


fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Egon Frerich via Python-list

I've no idea why this happens. In a module there are lists and definitions:

    Felder = [
    # Name   lg1  lg2 typ   Ausrichtung Holen Prüfen Prüfvorg
    ["Jahr", 4, 5, "u", "", "right", "center"],
    ["Monat", 2, 5, "u", "", "right", "center"],
    ["Tag", 2, 3, "u", "", "right", "center"],
    ["Belegnr", 5, 7, "s", "", "right", "center"],
    ["Bank", 2, 4, "u", "", "center", "center"],
    ["Art", 2, 3, "u", "", "center", "center"],
    ["Aufg", 2, 4, "u", "", "center", "center"],
    ["Text", 25, 25, "s", "-", "left", "left"],
    ["Ergänzung", 12, 12, "s", "-", "left", "left"],
    ["Betrag", 13, 13, "s", "", "right", "right"],
    ["W", 1, 2, "s", "", "center", "center"],
    ["WBetrag", 7, 7, "s", "", "right", "right"],
    ["Kurs", 6, 6, "s", "", "right", "right"],
    ]
    "Reihenfolge in der Dimension 1"
    (
    fJAHR,
    fMONAT,
    fTAG,
    fBELEGNR,
    fBANK,
    fART,
    fAUFGABE,
    fTEXT,
    fTEXTERG,
    fBETRAG,
    fWAEHRUNG,
    fBETRAGinWAEHRUNG,
    fUMRECHNUNGSKURS,
    ) = list(range(13))
    "Reihenfolge in der Dimension 2"
    (
    fNAME,
    fLG1,
    fLG2,
    fTYP,
    fCONV_AUSRICHTG,
    fENTRY_AUSRICHTG,
    fTEXT_AUSRICHTUNG,
    fHOLFUNKT,
    fPRUEFFUNKT,
    fPRUEF_ARG,
    ) = list(range(10))


Two lines with  test statements follow and the statement which produces 
an error:


    print(Felder)
    print(fJAHR, fNAME, fTYP, fCONV_AUSRICHTG)
    akette = "%" + "%".join(
    ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in 
Felder])


The traceback shows:

$ python3 testGeldspurGUI.py
[['Jahr', 4, 5, 'u', '', 'right', 'center'], ['Monat', 2, 5, 'u', '', 
'right', 'center'], ['Tag', 2, 3, 'u', '', 'right', 'center'], 
['Belegnr', 5, 7, 's', '', 'right', 'center'], ['Bank', 2, 4, 'u', '', 
'center', 'center'], ['Art', 2, 3, 'u', '', 'center', 'center'], 
['Aufg', 2, 4, 'u', '', 'center', 'center'], ['Text', 25, 25, 's', '-', 
'left', 'left'], ['Ergänzung', 12, 12, 's', '-', 'left', 'left'], 
['Betrag', 13, 13, 's', '', 'right', 'right'], ['W', 1, 2, 's', '', 
'center', 'center'], ['WBetrag', 7, 7, 's', '', 'right', 'right'], 
['Kurs', 6, 6, 's', '', 'right', 'right']]

0 0 3 4
Traceback (most recent call last):
  File "/home/egon/Entw/Geldspur/geldspur/testGeldspurGUI.py", line 15, 
in 

    from tests.testU2 import testU2
  File "/home/egon/Entw/Geldspur/geldspur/tests/testU2.py", line 9, in 


    from gui.GUI_Konfig import GUIcfg
  File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 11, 
in 

    class GUIcfg:
  File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, 
in GUIcfg

    ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
  File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, 
in 

    ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])
NameError: name 'fCONV_AUSRICHTG' is not defined

You see "Felder" and with "0 0 3 4" the correct value 4 for 
fCONV_AUSRICHTG. But there is the NameError.


What does  mean? Is there a change from python2 to python3?

Egon



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


RE: Checking if email is valid

2023-11-07 Thread AVI GROSS via Python-list
Text messages have taken a nasty turn and especially now that so many people
have unlimited messages per month in their plan. People overuse them to the
point where I opt out of some things like my home town notifications as they
bombard me with other things I am not interested in.

A major offender now is various forms of security which insist on not
letting you into a web site for your bank or other resources unless they
first send you an email or text message or perhaps a voice call with random
digits to use as verification. Try sitting somewhere with your phone muted
as all the beeps get annoying.

There are many reasons for preferences and I know many people find it harder
to reply to texts on their phone than to emails on a PC with a full
keyboard. 

But all of this is not really here or there. We are talking more about user
interface design than about programming, let alone about Python.

What strikes me as a useful direction is for people to suggest what
resources and methods in the Python world are helpful. Examples would be
modules that have been tested and used that do things well such as
validating phone numbers or emails, perhaps flexibly so that if a validation
fails, they prompt the user asking if they are sure it is correct and maybe
offer to let them type it in again for verification. Other ideas as stated
recently are routines that don't just ask for a number but specify the
purpose, and perhaps messages about what circumstances would trigger a use
of the number, such as if fraud is detected, and get you to opt in or
refuse.

Reusable libraries of sorts, or good documentation of examples, would
perhaps help make User Interface design and customer satisfaction better and
show Python as a good way to do some kinds of programs.

In that light, I wonder if it makes sense to NOT insist people give you
their email address at all, and make it optional so they do not need to
provide you with something bogus just to go on.

-Original Message-
From: Python-list  On
Behalf Of D'Arcy Cain via Python-list
Sent: Tuesday, November 7, 2023 11:24 AM
To: python-list@python.org
Subject: Re: Checking if email is valid

On 2023-11-07 08:40, Grant Edwards via Python-list wrote:
> If you, as a web developer, want the user to enter a text-message
> capable phone number, then ASK FOR THAT!

And you may as well ask if they even want you to send texts whether they 
can technically receive them or not.

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com

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

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


RE: Python Golf

2023-11-07 Thread AVI GROSS via Python-list


Discussions like this feel a bit silly after a while. How long something is
to type on a command line is not a major issue and brevity can lead to being
hard to remember too especially using obscure references.

Consider that the Perl version as shown below does not need to import
anything. If you had python import sys by default and perhaps even create a
briefer alias for sys.stdin, then this gets shorter:

py -c "import sys; print(sum(int(F.split()[1])for F in sys.stdin))"  On
Behalf Of Jon Ribbens via Python-list
Sent: Tuesday, November 7, 2023 11:06 AM
To: python-list@python.org
Subject: Re: Python Golf

On 2023-11-07, Stefan Ram  wrote:
>   I read this in a shell newsgroup:
>
> perl -anE '$s += $F[1]; END {say $s}' in
>
>   , so I wrote
>
> py -c "import sys; print(sum(int(F.split()[1])for F in sys.stdin))" 
>   to show that this is possible with Python too. 
>
>   But now people complain that it's longer than the Perl version.
>
>   Do you see ways to make it shorter (beyond removing one space
>   after the semicolon ";")?

It's a bit of an unfair competition given that, unlike Perl,
Python is not designed to be an 'awk' replacement.

Having said that, you could make it a bit shorter:

py -c "print(sum(int(F.split()[1])for F in open(0)))" https://mail.python.org/mailman/listinfo/python-list

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


Re: Writing to clipboard in Python 3.11

2023-11-07 Thread MRAB via Python-list

On 2023-11-06 00:51, Rob Cliffe via Python-list wrote:

Recently I switched from Python 3.8.3 to Python 3.11.4.  A strange
problem appeared which was not there before:
I am using the win32clipboard backage (part of pywin32), and when I use
SetClipboardData() to write text which consists ENTIRELY OF DIGITS to
the clipboard, I either get an error (not always the same error message)
or a program crash.  The problem does not appear if I use
SetClipboardText() instead.
Sample program:

from win32clipboard import *
OpenClipboard()
SetClipboardData(CF_UNICODETEXT, "A")
SetClipboardData(CF_UNICODETEXT, "A0")
SetClipboardData(CF_UNICODETEXT, "0A")
SetClipboardText("0", CF_UNICODETEXT)
print("OK so far")
SetClipboardData(CF_UNICODETEXT, "0")
CloseClipboard()

Sample output:

OK so far
Traceback (most recent call last):
    File "R:\W.PY", line 8, in 
      SetClipboardData(CF_UNICODETEXT, "0")
pywintypes.error: (0, 'SetClipboardData', 'No error message is available')

I can get round the problem by using SetClipboardText().  But can anyone
shed light on this?


It also happens in Python 3.10, but not Python 3.9.

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


Writing to clipboard in Python 3.11

2023-11-07 Thread Rob Cliffe via Python-list
Recently I switched from Python 3.8.3 to Python 3.11.4.  A strange 
problem appeared which was not there before:
I am using the win32clipboard backage (part of pywin32), and when I use 
SetClipboardData() to write text which consists ENTIRELY OF DIGITS to 
the clipboard, I either get an error (not always the same error message) 
or a program crash.  The problem does not appear if I use 
SetClipboardText() instead.

Sample program:

from win32clipboard import *
OpenClipboard()
SetClipboardData(CF_UNICODETEXT, "A")
SetClipboardData(CF_UNICODETEXT, "A0")
SetClipboardData(CF_UNICODETEXT, "0A")
SetClipboardText("0", CF_UNICODETEXT)
print("OK so far")
SetClipboardData(CF_UNICODETEXT, "0")
CloseClipboard()

Sample output:

OK so far
Traceback (most recent call last):
  File "R:\W.PY", line 8, in 
    SetClipboardData(CF_UNICODETEXT, "0")
pywintypes.error: (0, 'SetClipboardData', 'No error message is available')

I can get round the problem by using SetClipboardText().  But can anyone 
shed light on this?

Best wishes
Rob Cliffe
--
https://mail.python.org/mailman/listinfo/python-list


Re: Checking if email is valid

2023-11-07 Thread D'Arcy Cain via Python-list

On 2023-11-07 08:40, Grant Edwards via Python-list wrote:

If you, as a web developer, want the user to enter a text-message
capable phone number, then ASK FOR THAT!


And you may as well ask if they even want you to send texts whether they 
can technically receive them or not.


--
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com

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


Re: Python Golf

2023-11-07 Thread Jon Ribbens via Python-list
On 2023-11-07, Stefan Ram  wrote:
>   I read this in a shell newsgroup:
>
> perl -anE '$s += $F[1]; END {say $s}' in
>
>   , so I wrote
>
> py -c "import sys; print(sum(int(F.split()[1])for F in sys.stdin))" 
>   to show that this is possible with Python too. 
>
>   But now people complain that it's longer than the Perl version.
>
>   Do you see ways to make it shorter (beyond removing one space
>   after the semicolon ";")?

It's a bit of an unfair competition given that, unlike Perl,
Python is not designed to be an 'awk' replacement.

Having said that, you could make it a bit shorter:

py -c "print(sum(int(F.split()[1])for F in open(0)))" https://mail.python.org/mailman/listinfo/python-list


Re: Checking if email is valid

2023-11-07 Thread Grant Edwards via Python-list
On 2023-11-06, Greg Ewing via Python-list  wrote:
> On 7/11/23 7:45 am, Mats Wichmann wrote:
>> Continuing with the example, if you have a single phone number field, or 
>> let a mobile number be entered in a field marked for landline, you will 
>> probably assume you can text to that number.
>
> But if the site can detect that you've entered a mobile number into
> the landline field or vice versa and reject it, then it can figure out
> whether it can text to a given numner or not without you having
> to tell it!

Maybe. I'm pretty sure the last time I was in Australia, you could
send/recieve text messages from landalines. And I've had mobile number
that didn't support text messaging.

If you, as a web developer, want the user to enter a text-message
capable phone number, then ASK FOR THAT!


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


Re: Detect naming typos (AttributeError) in function names

2023-11-07 Thread Thomas Passin via Python-list

On 11/7/2023 2:48 AM, Christian Buhtz via Python-list wrote:

Hello Dieter,

thanks for your reply.

Am 06.11.2023 19:11 schrieb Dieter Maurer:

One option is a test suite (--> Python's "unittest" package)
with a sufficiently high coverage (near 100 %).


Yes, that is the primary goal. But it is far away in the related project.

I got a hint that "pylint" is able to detect problems like this.


mypy can detect typos in names by noticing that they haven't been 
declared.  For example, if you have a class NewClass(BaseClass), and 
BaseClass has a method findme(), but you call it as findMe(), mypy will 
tell you findMe does not exist in BaseClass.  It can be annoying to get 
the options set right so you don't get too many undesired hits, but it's 
certainly doable.  mypy can be slow, depending on your code.


You could also simply run py_compile, which will try to compile the 
code.  It will stop at the first error it finds.


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


Aw: Re: pip/pip3 confusion and keeping up to date

2023-11-07 Thread Karsten Hilbert via Python-list
> > .From all the posts I gather the answer to my question is
> > "simply": unpackaged-but-needed modules need to be packaged.
>
> I think there is one aspect that isn't getting consideration here.  And
> that is whether or not you want these packages installed in the default
> system Python install.  You might not.

Indeed, which is why all the fuzz about how to fill-in a venv from pip while
installing with apt :-)

With "properly" packaged modules one wouldn't risk (that much) system
breakage, at any rate.

>  Maybe you want to get the latest
> possible version of super-dooper-gui-helper, but one of its dependencies
> doesn't play well with the system Python libraries. Or ... but you get
> the point.  There are probably many cases where you want *not* to
> install into the system Python world.  So you would need to come up with
> an APT-based installer that doesn't do that.
>
> Obviously it's not unthinkable;

Certainly not, it's just that I had hoped someone goes: look here
and all of this ...

> it is just one more thing to figure out.

... has been thought through before.

Thanks,
Karsten
-- 
https://mail.python.org/mailman/listinfo/python-list