Re: How to Add ANSI Color to User Response

2024-04-10 Thread David via Python-list
On Wed, 10 Apr 2024 at 18:51, WordWeaver Evangelist via Python-list wrote: > I have a simple question. I use the following textPrompt in some of my > Jython modules: > '\n [1;33mYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, > forceUppercase=True) > Is there a way to add an ANS

RE: Context without manager

2023-11-27 Thread David Raymond via Python-list
> I *must* do: > > with device_open() as device: >device.do_something() > > Nevertheless, I _need_ to have a class > where the device is opened in the __init__() > and used in some methods. > > Any ideas? Perhaps take a look at contextlib.ExitStack and see if you can do something with it.

FlaskCon 2023 CFP

2023-10-17 Thread David Carmichael via Python-list
Hello All! I'd like to inform you that FlaskCon 2023 is currently calling for proposals, and you are invited to submit. *Submission Details:* Deadline: 31st Oct Submit Your Proposal: https://flaskcon.com/ Any submissions would be greatly appreciated. Best regards, *David Carmi

Re: wordplay

2023-05-30 Thread David Dalton
In article , David Dalton wrote: > cODINg :-) Since Odin is described as the Sky Father, I think he is the one I call Cosma, not the one I call Gwydion or the avatar type who was the author of Havamal 138--141. c I take to represent light. g I take to represent gravity. -- ht

pip module not found

2023-05-12 Thread David John
Hi, I recently have been experiencing issues with the pip installation module. I have python version 3.11 installed. I've checked the directory installed in the systems variables window and nothing is amiss. Kindly assist. Regards, David -- https://mail.python.org/mailman/listinfo/python-list

RE: Initialising a Config class

2023-04-11 Thread David Raymond
Not sure if I'm fully understanding the question. But one option instead of making everything class attributes is to just define __getattr__ for when it doesn't find an attribute. Won't work for every single valid section and option name (because of spaces, name overlaps, etc) but should cover

RE: Problem with __sub__

2023-03-23 Thread David Raymond
I believe your problem is __rsub__, not __sub__. When you havethen that uses the "r" version of the operators. In your __rsub__ (used when you have - ) you instead return - which is backwards. Notice how the final return should also be -4,95 and not the +4,95 it's returning. > If on th

RE: Debugging reason for python running unreasonably slow when adding numbers

2023-03-15 Thread David Raymond
> Then I'm very confused as to how things are being done, so I will shut > up. There's not enough information here to give performance advice > without actually being a subject-matter expert already. Short version: In this specific case "weights" is a 5,147 element list of floats, and "input" is

RE: Debugging reason for python running unreasonably slow when adding numbers

2023-03-15 Thread David Raymond
> Or use the sum() builtin rather than reduce(), which was > *deliberately* removed from the builtins. The fact that you can get > sum() without importing, but have to go and reach for functools to get > reduce(), is a hint that you probably shouldn't use reduce when sum > will work. Out of curios

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-07 Thread David Lowry-Duda
On 22:43 Sat 04 Mar 2023, Dino wrote: How can I implement this? A library called Whoosh seems very promising (albeit it's so feature-rich that it's almost like shooting a fly with a bazooka in my case), but I see two problems: 1) Whoosh is either abandoned or the project is a mess in terms of

RE: How to escape strings for re.finditer?

2023-02-28 Thread David Raymond
> I wrote my previous message before reading this.  Thank you for the test you > ran -- it answers the question of performance.  You show that re.finditer is > 30x faster, so that certainly recommends that over a simple loop, which > introduces looping overhead.  >>     def using_simple_loop(

RE: Find 6-letter words that are hidden (embedded) within

2023-02-24 Thread David Raymond
> Find 6-letter words that are hidden (embedded) within each row of letters. > The letters are in the correct order. > > 1. JSOYOMFUBELR > 2. SCDUARWDRLYE > 3. DASNAGEFERTY > 4. CLULOOTSCEHN > 5. USENEARSEYNE > The letters are in the correct order. S

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-25 Thread David
On Thu, 26 Jan 2023 at 04:24, Jach Feng wrote: > Chris Angelico 在 2023年1月25日 星期三下午1:16:25 [UTC+8] 的信中寫道: > > On Wed, 25 Jan 2023 at 14:42, Jach Feng wrote: > > You're still not really using argparse as an argument parser. Why not > > just do your own -h checking? Stop trying to use argparse for

Re: bool and int

2023-01-24 Thread David
On Wed, 25 Jan 2023 at 12:19, Mike Baskin via Python-list wrote: > Will all of you please stop sending me emails Hi. We don't have the power to do that. Because this is a public list, which works by people adding and removing themselves. You, or perhaps someone messing with you, added your email

Re: Fast lookup of bulky "table"

2023-01-15 Thread David
On Mon, 16 Jan 2023 at 16:15, Dino wrote: > BTW, can you tell me what is going on here? what's := ? > > while (increase := add_some(conn,adding)) == 0: See here: https://docs.python.org/3/reference/expressions.html#assignment-expressions https://realpython.com/python-walrus-operator/ --

Re: Nonuniform PRNG?

2022-12-07 Thread David Lowry-Duda
tical tests against nonuniform PRNGs had already been done somewhere. -- David Lowry-Duda -- https://mail.python.org/mailman/listinfo/python-list

Re: on the python paradox

2022-12-07 Thread David Lowry-Duda
On Mon, Dec 05, 2022 at 10:37:39PM -0300, Sabrina Almodóvar wrote: The Python Paradox Paul Graham August 2004 [SNIP] Hence what, for lack of a better name, I'll call the Python paradox: if a company chooses to wri

Nonuniform PRNG?

2022-12-07 Thread David Lowry-Duda
Inspired by the recent thread about pseudorandom number generators on python-ideas (where I also mistakenly first wrote this message), I began to wonder: suppose that I had a pseudorandom number generator that attempted to generate a nonuniform distribution. Suppose for instance that it was to

Re: What is the reason from different output generate using logical 'and' and 'or' operator in Python 3.10.8

2022-11-07 Thread David
On Tue, 8 Nov 2022 at 03:08, ICT Ezy wrote: > Please explain how to generate different output in following logical > operations > >>> 0 and True > 0 > >>> 0 or True > True > >>> 1 and True > True > >>> 1 or True > 1 Hi, The exact explanation of how 'and' and 'or' behave can be read here: ht

Re: Quick question about CPython interpreter

2022-10-17 Thread David Lowry-Duda
One can use the `dis` module and investigate the generated python bytecode. For me, I get # file "dis1.py" thing = 123 for i in range(10): if "hi" == str(thing): print("found") break The bytecode is then 1 0 LOAD_CONST 0 (123) 2 STORE

Re: flattening lists

2022-10-11 Thread David Lowry-Duda
On Tue, Oct 11, 2022 at 12:32:23PM -0700, SquidBits _ wrote: Does anyone else think there should be a flatten () function, which just turns a multi-dimensional list into a one-dimensional list in the order it's in. e.g. [[1,2,3],[4,5,6,7],[8,9]] becomes [1,2,3,4,5,6,7,8,9]. I have had to flatt

Pythonic way to run the asyncio loop forever in python 3.10

2022-10-06 Thread David Jander
Python 3.11 seems to mitigate this problem by introducing the asyncio.Runner() context-manager. But for the time being for 3.10, I see no good solution. Best regards, -- David Jander -- https://mail.python.org/mailman/listinfo/python-list

Re: Mutating an HTML file with BeautifulSoup

2022-08-19 Thread David
On Sat, 20 Aug 2022 at 04:31, Chris Angelico wrote: > What's the best way to precisely reconstruct an HTML file after > parsing it with BeautifulSoup? > Note two distinct changes: firstly, whitespace has been removed, and > secondly, attributes are reordered (I think alphabetically). There are >

Re: Problem using cx_Freeze > auto-py-to-exe

2022-08-18 Thread David at Booomer
From: Dennis Lee Bieber > > On Wed, 17 Aug 2022 12:09:14 -0600, David at Booomer > declaimed the following: > >> executables=[ >> Executable( >> >> "prjui.py","Maiui.py","about.py","dict.py

Re: Problem using cx_Freeze

2022-08-17 Thread David at Booomer
mention of adding self which is in these lines already. Previously I had search for __init__() which returned no lines due to the closing ). I had visited the page you provided (https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cx-freeze-executable) but didn’t noticed the 11 plus self as 12

Re: Problem using cx_Freeze

2022-08-15 Thread David at Booomer
has self. Thanks, David > On Aug 15, 2022, at 5:51 PM, Jim Schwartz wrote: > > This link covers how to use BDist_dmg. > > https://cx-freeze.readthedocs.io/en/latest/setup_script.html > > Sent from my iPhone > >> On Aug 15, 2022, at 12:11 PM, David at Booomer

Problem using cx_Freeze

2022-08-15 Thread David at Booomer
rminal the command: python setup.py build gives much the same error. I believe there is an issue specifying the output file name but don’t know how to resolve it. Any suggestions, thanks. David -- https://mail.python.org/mailman/listinfo/python-list

RE: Parallel(?) programming with python

2022-08-08 Thread David Raymond
>> But, an easier and often >> better option for concurrent data access is use a (relational) >> database, then the appropriate transaction isolation levels >> when reading and/or writing. >> > > That would obviusly save some coding (but would introduce the need to > code the interaction with the d

Pip upgrade causing issues in 3.10

2022-07-19 Thread David Raymond
So after a long while I'm finally getting around to upgrading to 3.10 on Windows from 3.9, and my first pip upgrade is causing issues with the installation. Problem seems to be that I run pip from a command prompt in the Scripts folder, and it seems pip is trying to completely remove the Script

Re: My first attempt at a package.

2022-07-19 Thread David Lowry-Duda
On Tue, Jul 19, 2022 at 03:58:41PM +0200, Antoon Pardon wrote: I am writing a python package which has the following structure PACKAGE    * module1.py    * module2.py    * data.cfg However the data.cfg should be build at installation time. Can someone give advise on which packaging tool and ho

Re: WHAT THE ERROR ON MY CODE???

2022-06-28 Thread David Lowry-Duda
Please don't use all caps in the subject line. It comes across as if you're yelling at the list --- this doesn't make people want to be more helpful. Instead, use meaningful, specific subject headers. Also, please be precise and informative about what your problem is. It's not clear what you

Re: 3.11.0b4?

2022-06-24 Thread Richard David
On Friday, June 24, 2022 at 11:36:06 AM UTC-4, Mats Wichmann wrote: > On 6/23/22 07:14, Richard David wrote: > > Is there a new scheduled date for releasing 3.11.0b4? Are there issues with > > b4 that have implications for b3? > > > > I realize it will be released w

Re: 3.11.0b4?

2022-06-24 Thread Richard David
On Thursday, June 23, 2022 at 9:15:19 AM UTC-4, Richard David wrote: > Is there a new scheduled date for releasing 3.11.0b4? Are there issues with > b4 that have implications for b3? > > I realize it will be released when ready and am not trying to push or harass > anyone in

Re: "CPython"

2022-06-24 Thread David J W
oking into it further, all I will say is that doesn't feel like a very appealing use of my time. On Thu, Jun 23, 2022 at 9:42 AM Avi Gross wrote: > David, > > I am curious why you are undertaking the effort to take a language already > decades old and showing signs of being a ta

3.11.0b4?

2022-06-23 Thread Richard David
Is there a new scheduled date for releasing 3.11.0b4? Are there issues with b4 that have implications for b3? I realize it will be released when ready and am not trying to push or harass anyone involved. It just seems that versions are usually released on schedule so I'm wondering if there's s

Re: "CPython"

2022-06-23 Thread David J W
>> Let's say they reimplement "reference python" CPython in Rust. What is >> better? Change the "reference python" CPython name to RPython, for >> example, or let it as CPython? >The C implementation would still be called CPython, and the new >implementation might be called RPython, or RustyPython

Re: Tkinter - cannot import tklib

2022-06-21 Thread David
On Tue, 21 Jun 2022 at 09:22, Wolfgang Grafen wrote: > I am an experienced Python user and struggle with following statement: > > >>> from tklib import * > Traceback (most recent call last): > File "", line 1, in > ModuleNotFoundError: No module named 'tklib' [...] > I did not find a python mo

PYLAUNCH_DEBUG not printing info

2022-06-08 Thread Richard David
Why am I not getting debug output on my windows 10 machine: C:\temp>\Windows\py.exe -0 -V:3.11 *Python 3.11 (64-bit) -V:3.10 Python 3.10 (64-bit) C:\temp>set PYLAUNCH_DEBUG=1 C:\temp>\Windows\py.exe Python 3.11.0b3 (main, Jun 1 2022, 13:29:14) [MSC v.1932 64 bit (AMD64)] on

RE: Changing calling sequence

2022-05-12 Thread David Raymond
>>def TempsOneDay(*dateComponents): >>if len(dateComponents) == 3: >>year, month, date = dateComponents >>elif len(dateComponents) == 1 and isinstance(dateComponents[0], >> datetime.date): >>year, month, date = (dateComponents[0].year, dateComponents[0].month, >> dateCompo

RE: Changing calling sequence

2022-05-11 Thread David Raymond
>> I have a function that I use to retrieve daily data from a >> home-brew database. Its calling sequence is; >> >> def TempsOneDay( year, month, date ): >> >> After using it (and its friends) for a few years, I've come to >> realize that there are times where it would be advantageous to >> invok

Re: Extract specific no of data from nedCDF files using python

2022-02-24 Thread David Lowry-Duda
> Hi.I am learning python and I am working with some netCDF files. > Suppose I have temperature data from 1950-2020 and I want data for > only 1960-2015. How should I extract it. -- Alternately, use https://unidata.github.io/netcdf4-python/ or gdal. It might also be possible to read https://st

RE: One-liner to merge lists?

2022-02-22 Thread David Raymond
> Is there a simpler way? >>> d = {1: ['aaa', 'bbb', 'ccc'], 2: ['fff', 'ggg']} >>> [a for b in d.values() for a in b] ['aaa', 'bbb', 'ccc', 'fff', 'ggg'] >>> -- https://mail.python.org/mailman/listinfo/python-list

Error installing requirements

2022-02-18 Thread Saruni David
PS C:\Users\Nepapa David\cpims_api> pip install -r requirements/base.txt DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details ab

Re: Unpacking lists in a f string

2022-02-09 Thread David Lowry-Duda
> l1=['a','b','c'] > l2=['j','k','l'] > > I want to build a string like this > "foo a j, b k, c l bar" > Is it possible to achieve this with f strings or any other > simple/efficient way? Here is a small list of things that want to be done (and natural ways to perform them) 1. pair items in th

RE: frozenset can be altered by |=

2021-11-22 Thread David Raymond
>> (venv_3_10) marco@buzz:~$ python >> Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) >> [GCC 10.1.1 20200718] on linux >> Type "help", "copyright", "credits" or "license" for more information. >> >>> a = frozenset((3, 4)) >> >>> a >> frozenset({3, 4}) >> >>> a |= {5,} >> >>> a

Re: Advantages of Default Factory in Dataclasses

2021-11-18 Thread David Lowry-Duda
On Tue, Nov 16, 2021 at 06:24:43PM -0500, Alan Bawden wrote: >```python >def add_to(elem, inlist=[]): >inlist.append(elem) >return inlist > >list1 = add_to(1) >list2 = add_to(2) >print(list1) # prints [1] >print(list2) # prints [1, 2], potentially confusin

Re: Advantages of Default Factory in Dataclasses

2021-11-16 Thread David Lowry-Duda
On Tue, Nov 16, 2021 at 05:04:05PM +0400, Abdur-Rahmaan Janhangeer wrote: > A simple question: why do we need field(default_factory ) in > dataclasses? For the same reason that the following code doesn't do what some people might expect it to: ```python def add_to(elem, inlist=[]): inlist.a

Re: Getting Directory of Command Line Entry Point For Packages

2021-11-12 Thread David L Neil via Python-list
On 13/11/2021 10.51, Abdur-Rahmaan Janhangeer wrote: > Greetings list, > > Let's say i created a package named miaw > > miaw also has a cli command called miaw > > miaw prints files and folders in the directory it is called in > > except that when miaw is used, it prints the files and folders i

Re: Syntax not understood

2021-11-04 Thread David Lowry-Duda
> x_increment, y_increment = (scale * i for i in srcpages.xobj_box[2:]) > > (scale * i for i in srcpages.xobj_box[2:]) is a generator, a single > object, it should not be possible to unpack it into 2 variables. If you know the exact number of values in the generator, you can do this. Here is an

Re: The task is to invent names for things

2021-10-26 Thread David L Neil via Python-list
On 27/10/2021 12.29, Stefan Ram wrote: > dn writes: >> On 27/10/2021 11.16, Stefan Ram wrote: >>> The Mental Game of Python - Raymond Hettinger (PyBay 2019) >>> | "The computer gives us words that do ### things. > ... >> Alternately, if your question was to identify the mumbled word, it is >> (se

Re: Mailing list activity low

2021-10-12 Thread David Lowry-Duda
> Have I missed something and has the maillinglist been moved. Activity > is very low here, about one message every five days. I think you might need to check how you access the mailing list. There have been more than 5 messages in the last day. See for example the archives: https://mail.pyth

Re: matplotlib graph white space

2021-10-04 Thread David Lowry-Duda
> I am using the first bar graph listed at this site: > https://matplotlib.org/stable/gallery/index.html > > The problem I have is that there is too much white space around the graph. > My data would be better displayed if I could widen the graph into the space > to the right and left of the chart

Re: XML Considered Harmful

2021-09-24 Thread David L Neil via Python-list
On 25/09/2021 11.00, Chris Angelico wrote: > Invented because there weren't enough markup languages, so we needed another? Anything You Can Do I Can Do Better https://www.youtube.com/watch?v=_UB1YAsPD6U -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

[Hint]: python simulator http

2021-09-22 Thread David Caul
Hi All, Making any simulator http request , response base simulator with some UI on browser , what are all things python package can support br David -- https://mail.python.org/mailman/listinfo/python-list

RE: on writing a while loop for rolling two dice

2021-08-30 Thread David Raymond
> def how_many_times(): > x, y = 0, 1 > c = 0 > while x != y: > c = c + 1 > x, y = roll() > return c, (x, y) Since I haven't seen it used in answers yet, here's another option using our new walrus operator def how_many_times(): roll_count = 1 while (rolls := roll())[0] !=

Re: matplotlib questions

2021-08-27 Thread David Lowry-Duda
> I am trying to modify the "Bar Graph Demo" at > https://matplotlib.org/stable/gallery/index.html, Lines, bars, and > markers > but the more I experiment and change the code, the more messed up it > becomes. It is much easier to give constructive suggestions if you give a minimum runnable code

typing instance variable

2021-05-13 Thread David Kolovratník
lly declare instance variables in the class body attr: int # This is an instance variable with a default value charge_percent: int = 100 Why Python believes foo is class variable? python3 -V Python 3.6.8 Kind regards, David -- https://mail.python.org/mailman/listinfo/python-list

Re: do ya still use python?

2021-04-23 Thread David Lowry-Duda
> You wouldn't see Tim Peters or even Guido here nowadays, and > Steven D'Aprano was IMO forced out for no good reason ... you see > the results here every day... What happened to Steven D'Aprano? - DLD -- https://mail.python.org/mailman/listinfo/python-list

Re: do ya still use python?

2021-04-23 Thread David Lowry-Duda
> Are there reasons why someone might prefer StackOverflow to this list? > Are they more to do with the person, or something the Python Community > should address? I think general discoverability is a driving force. A beginner has a problem, goes to google, types in their problem, and sees some l

Re: Matplotlib scale

2021-04-05 Thread David Lowry-Duda
Hello, > I've created a code to run a 2D mapping using matplotlib from a .csv > file. > I've tried to set the maximum color (red) of the scale as 80% of the maximum > value and not as the maximum value of my .csv file. > Does someone know how to modify that? If I understand what you're trying t

Re: Using pytest, sometimes does not capture stderr

2021-04-04 Thread David
On Mon, 5 Apr 2021 at 14:26, Cameron Simpson wrote: > On 05Apr2021 13:56, David wrote: > >Thanks for confirming my suspicions so quickly. What you wrote > >makes sense, but there are two points that still puzzle me. > >1) The final line of the pytest failure outpu

Re: Using pytest, sometimes does not capture stderr

2021-04-04 Thread David
On Mon, 5 Apr 2021 at 13:44, Cameron Simpson wrote: > On 05Apr2021 13:28, David wrote: > >Can anyone explain why the module_2.py test fails? > >Is it because stderr during module import is not the same as during test? > >Is it something to do with mutable defaults? >

Using pytest, sometimes does not capture stderr

2021-04-04 Thread David
ptured = capsys.readouterr() assert captured.err == """a message\n""" #- Here is the pytest output: $ pytest-3 test session starts = platform linux -- Python 3.7.3, pytest-3.10.1, py-1.7.0, pluggy-0.8.0 rootdir

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-01 Thread David L Neil via Python-list
Officially April-Fools Day is over (here), but... On 01/04/2021 19.25, Chris Angelico wrote: > On Thu, Apr 1, 2021 at 3:36 PM dn via Python-list > wrote: >> >> On 01/04/2021 13.54, Chris Angelico wrote: >>> Real and imaginary are the same thing, just rotated a quarter turn >> >> In which dim

Re: .title() - annoying mistake

2021-03-20 Thread David Kolovratník
27; > > This is the "Dz" character. > > When you write that code to capitalize your book titles, you should be > calling .title() rather than .upper() if you are doing it right. It would be great to read this reasoning in the documentation. Cheers, David -- https://mail.python.org/mailman/listinfo/python-list

Re: Why assert is not a function?

2021-03-03 Thread David Lowry-Duda
> assert condition, expression > > Only is condition is false with expression be evaluated. > So you can safely do expensive things I the expression with incuring > and cost if the condition is True. I think I've only every used a string as the expression. Have you found it useful to use compli

Re: New Python implementation

2021-02-16 Thread David Lowry-Duda
uage do they use? And does it influence math education at all? (Coming from someone who sometimes tries to teach undergraduates about math). - David Lowry-Duda -- https://mail.python.org/mailman/listinfo/python-list

Re: Very starnge problem in python

2021-02-10 Thread David Lowry-Duda
t. You can examine this with this little code. ``` arr = [1, 2, 3] arr_other = arr arr_other[1] = "different" print(arr_other) # This line prints the same print(arr) # array as this line. ``` Thus when you assign `tt = arr2`, modifying `tt` will modify `arr2`, and vice-ver

RE: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

2021-01-27 Thread David Raymond
In regards to the various comments about adding in print() calls what I've found myself doing is to basically always use the logging module, and use logging.debug() for those. Somewhere at the top of the script I'll have a line like... DEBUG = False ...and when initializing the handler to stdo

Re: Mailing

2021-01-21 Thread David Lowry-Duda
On Thu, Jan 21, 2021 at 06:19:03AM -0500, TheGemmyGuy wrote: > A quick question; for mailing, do I send a message through e-mail or the > Python Mailman page? Whatever you did here works. I use email. - DLD -- https://mail.python.org/mailman/listinfo/python-list

Re: Application window geometry specifier

2021-01-13 Thread David L Neil via Python-list
On 14/01/2021 15.25, boB Stepp wrote: > On Wed, Jan 13, 2021 at 7:28 PM Chris Angelico wrote: > >> I love how "I think" is allowed to trump decades of usability research. I'm just pleased that @Chris has found love! (not detracting from the point though) > Can you recommend a good reference fo

Re: argparse presence of switch

2021-01-12 Thread David Lowry-Duda
> I want to have an argument's presence only - value is not required. > For example, my program main.py needs to know if "-r" is present when program > is invoked. > So the value command line would be: > (1) python3 main.py -r > or... > (1) python3 main.py > > I tried following: > parser.add_ar

Re: primitive password cracker

2021-01-07 Thread David Kolovratník
its end. I stop here in order to leave space for Bischoop's deliberation. To sum up in order words, the clue is to stop thinking of inner loops for each letter and find a way to get the next combination. Best, David On Thu, Jan 07, 2021 at 04:52:56PM -, Bischoop wrote: > On 2021-01-0

Re: Some problem in code execution in python

2021-01-07 Thread David L Neil via Python-list
On 07/01/2021 22.44, Dario Dario wrote: > Sir, I am one of the user of your python program, that is after completion > of installation I got some statement like "you got code execution problem > ". I don't know how to rectify this problem.so please help me to rectify > this problem . > You send me

RE: primitive password cracker

2021-01-07 Thread David Raymond
I think you might want to check out itertools.product() https://docs.python.org/3.9/library/itertools.html#itertools.product import itertools import string passe = 'pass' for p in itertools.product(string.ascii_lowercase, repeat = 4): p = "".join(p) if p == passe: print("Found it:"

Re: tkinter global variable

2020-11-13 Thread David Kolovratník
o what do I need to do access the variable? How > >> do I return a value from that function? > >> > >> Thanks. > > > > The problem is that you are accessing the variable BEFORE the box has > > been put up and the user clicking on it. That doesn't happen until the > > mainloop() call. You need to delay the opening and reading of the file > > till the filedialog has been used and returned. > > > > Perhaps on_openfile could open and read the file. > > Ok. Then how do I access the content of the file from outside the > function? How can I access return value? > Thanks. What about def on_printfilename(): global pic try: print( f"C: {pic}" ) except NameError: print( f"C! pic not set yet" ) together with file_menu.add_command(label="Print filename", command=on_printfilename) Or move your print("B") block behind the mainloop(). David -- https://mail.python.org/mailman/listinfo/python-list

constant folding - why not more

2020-11-10 Thread David Kolovratník
Dear all, I would like to learn about constant folding optimisation in Python. It seems to be implemented in Python/ast_opt.c. In order to get impression I used python3 and dis module: $ python3 -V Python 3.7.3 Arithmetics expression is folded as expected: >>> dis.dis(compile('1 * 2', filename=

IDEL from Windows It does not work

2020-11-04 Thread David Ruíz Domínguez
IDEL from Windows It does not work, started the program and won’t open it. I already uninstalled and reinstalled it and it still does not open thanks for your service   Enviado desde [1]Correo para Windows 10   References Visible links 1. https://go.microsoft.com/fwlin

Re: Strange terminal behavior after quitting Tkinter application

2020-11-03 Thread David Burnette
On Wednesday, April 18, 2007 at 12:33:24 AM UTC-7, Chris wrote: > Hi, > I'm puzzled by some strange behavior when my Python/Tkinter > application quits (on linux): the terminal from which I started Python > is messed up. > If start up python, then import the code below, then start the program > wit

RE: Are there Python ways to execute queries on PostgreSQL without getting data over?

2020-10-19 Thread David Raymond
> Are there Python ways to execute queries on PostgreSQL without getting data > over? > > Are there ways just to fire off PostgreSQL queries and not get data into > Python? > > Regards, > > David What is your use case for this? Normally when you do basic things

Re: lmoments3 and scipy (again)

2020-10-14 Thread David Painter
Thank you, Kyle and Dennis. The developer version from 17 months ago, which I hadn't spotted, has solved my immediate problem. It would be good to have it mainstreamed to prevent others having the same problem. David On Thu, 15 Oct 2020 at 09:07, Dennis Lee Bieber

lmoments3 and scipy (again)

2020-10-13 Thread David Painter
48.3,46.6] >>> paras = distr.gpa.lmom_fit(data) Traceback (most recent call last): File "", line 1, in paras = distr.gpa.lmom_fit(data) File "C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\distr.py", line 59, in lmom_fit

RE: [RELEASE] Python 3.8.6 is now available

2020-09-29 Thread David Raymond
> Python 3.8.6 is the sixth maintenance release of Python 3.8. Go get it here: > https://www.python.org/downloads/release/python-386/ > Just a quick note that there still seem to be a few places on the website which are still showing 3.8.5

Re: Question from a "java background" developer

2020-09-22 Thread David Lowry-Duda
. And given an object or funcation, appending `?` will bring up the documentation (as given in the docstring) for that object or function. This is true even for user-defined functions and objects, even if they were defined during the same interactive session. Good luck! -- David Lowry-Du

RE: grouping and sorting within groups using another list

2020-09-02 Thread David Raymond
Would it be something as simple as: rows.sort(key = lambda x: (x[0], x[3], x[4], sort_list.index(x[6]))) -Original Message- From: Python-list On Behalf Of Larry Martell Sent: Wednesday, September 2, 2020 1:55 PM To: Python Subject: grouping and sorting within groups using another lis

Proposal: Ignore all empty entries within $PYTHONPATH

2020-08-29 Thread David A. Wheeler
All: I propose that all empty entries with $PYTHONPATH be ignored. This would eliminate some accidents that can lead to security problems. I thought it'd be easiest to explain by drafting a PEP, so please see this first draft below. Thanks! Comments welcome. --- David A. Wh

RE: Didn't understand the output of the following Python 3 code with reduce function?

2020-08-28 Thread David Raymond
All the numbers in the nums list don't matter and aren't used. Only the first number, and how many there are. https://docs.python.org/3.8/library/functools.html#functools.reduce Basically it's doing ADDS(1, 2) which returns 2 that 2 gets fed back into ADDS(2, 3) which returns 3 that 3 gets fed ba

RE: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread David Raymond
> Do I agree with the PR, not exactly. However, I do think we as a community > should be accommodating to people > Whose use of the English language differs from the standard as long as the > meaning is clear. Remember that the problem isn't the change in wording of the PEP. That's all well and g

Proposal: SimpleNamespace "recursive" parameter

2020-08-13 Thread David Rashty
It would be nice if you could do this to create a "nested" SimpleNamespace: >>> d = {"_meta": {"fields": ({"name": "field0"}, {"name": "field1"})}} >>> sns = SimpleNamespace(**d) >>> print(sns._meta.fields[0].name) # This is what I wish you could do 'field0' SimpleNamespace does this though: >>>

Re: Are instances of user-defined classes mutable?

2020-08-06 Thread David Lowry-Duda
n dictionary # d doesn't "know" that myobj1 and myobj2 are "the same" ``` This difference in behavior is due to the default __hash__ and __eq__ methods for myclass, which don't consider the attributes of each instance, whereas the hashing and comparison of tuples does consider the contents of the tuple. - DLD -- David Lowry-Duda -- https://mail.python.org/mailman/listinfo/python-list

Re: Winreg

2020-07-31 Thread David L Neil via Python-list
On 31/07/2020 16:48, R Pasco wrote: Thanks for your extensive info. Its too bad this isn't published in the python winreg/_winreg modules' info. Ray Pasco Welcome to the world of documentation! Perhaps you have 'discovered' something, or maybe you're using the tool in an unusual way, or mayb

Re: How to diagnose import error when importing from .so file?

2020-07-29 Thread David Lowry-Duda
ert it to Python 3 without having the > source? Unfortunately, you'll need to recompile the .so file (or replace the dependency). Good luck! - DLD -- David Lowry-Duda -- https://mail.python.org/mailman/listinfo/python-list

RE: Python Scripts

2020-07-21 Thread David Raymond
Remember to reply-all, so that python-list is included and can still see responses and offer help. If Python won't open them, then how do you know the scripts work? They work on someone else's computer you mean? Please provide the basics then so we can try to help out. What OS are you using? H

RE: Python Scripts

2020-07-21 Thread David Raymond
> im having problems when running python scripts > > When running the scripts it always closes immediately If you're running it in Windows, and running it by double clicking on a .py file, then it will pop up a console window while it's running, and then immediately close that window when the s

Re: New to python - Just a question

2020-07-03 Thread David Lowry-Duda
that come up while you're trying to write a solution, I think more people would be more inclined to help. Good luck! - DLD -- David Lowry-Duda -- https://mail.python.org/mailman/listinfo/python-list

Understanding interoperability

2020-06-30 Thread David Lowry-Duda
C is a frequent lowest-common-denominator language. Is my understanding right? - DLD -- David Lowry-Duda -- https://mail.python.org/mailman/listinfo/python-list

RE: how to let argument be optional falling back to certain integer

2020-06-22 Thread David Raymond
> This is true. I have written 0 as false in C so many times. But > clearly for me times have changed... I now look at numbers as a thing > in their own special class not to be confused as truth-values. (So much > so that I fell for this.) But I confess I still think of numbers as all > TRUE

RE: Is there anything in the script which could cause it to not run its full course please?

2020-05-04 Thread David Raymond
Not necessarily the cause of your problem, but if you're going to compare dates it should be as objects, or as text as year-month-day. Here you're comparing dates as text in day-month-year format. So January first comes before May 4th 2020 "01-01-" < "04-05-2020" ... 04-05-2020 09:30:

RE: Multiprocessing queue sharing and python3.8

2020-04-06 Thread David Raymond
= mp.Pool(initializer = pool_init, initargs = (mp_comm_queue,)) ... -Original Message- From: David Raymond Sent: Monday, April 6, 2020 4:19 PM To: python-list@python.org Subject: RE: Multiprocessing queue sharing and python3.8 Attempting reply as much for my own understanding. Are you on

RE: Multiprocessing queue sharing and python3.8

2020-04-06 Thread David Raymond
Attempting reply as much for my own understanding. Are you on Mac? I think this is the pertinent bit for you: Changed in version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes of the subprocess. See bpo-33725.

  1   2   3   4   5   6   7   8   9   10   >