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: 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: 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

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: 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: 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: 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: 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: 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: 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

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: 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: 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: 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: 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: 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: 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: 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: Developers are advised to purge these malicious packages

2019-12-07 Thread David Lowry-Duda
On Wed, Dec 04, 2019 at 07:17:58PM +0100, Christian Heimes wrote: > > At least the first pages are packaging files for Debian, Fedora, and > other Linux distributions. Downstream distributions provide a Python > > > > Attackers abuse the fact and try to typo-squat packages in hope that > somebod

Re: Developers are advised to purge these malicious packages

2019-12-04 Thread David Lowry-Duda
I notice that "python3-dateutil" is in over 4000 github repositories [1]. That sounds like a disaster. [1]: https://github.com/search?q=python3-dateutil&type=Code - DLD -- David Lowry-Duda -- https://mail.python.org/mailman/listinfo/python-list

Re: Jupyter Notebook -> PDF with A4 pages?

2019-10-14 Thread David Lowry-Duda
mething like \documentclass[12pt, a4paper]{article} If you wanted a completely different (and perhaps lackluster) approach, you could just view the notebook in your favorite browser and print-to-pdf. Good luck! DLD -- David Lowry-Duda -- https://mail.python.org/mailman/listinfo/python-list

Re: Get Count of function arguments passed in

2019-09-11 Thread David Lowry-Duda
add(*matrix): print(len(matrix)) and this will tell you how many arguments were passed in. Good luck! David Lowry-Duda -- https://mail.python.org/mailman/listinfo/python-list

Re: Xlabel and ylabel are not shown

2019-08-20 Thread David Lowry-Duda
()`, it can be a bit nonintuitive how to alter the plot through the MATLAB-style interface. I think this might be happening here. If you provide a complete minimally-running-code sample, I'd be happy to go through it in a bit more detail. - David Lowry-Duda -- https://mail.python.org/ma