Re: copy.copy

2021-11-22 Thread Jon Ribbens via Python-list
On 2021-11-22, ast wrote: > Hi, > > >>> a = 6 > >>> b = 6 > >>> a is b > True > > ok, we all know that Python creates a sole instance > with small integers, but: > > >>> import copy > >>> b = copy.copy(a) > &

Re: About get_axes() in Pandas 1.2.3

2021-11-22 Thread Mahmood Naderan via Python-list
encies >without modifying anything on the host system. Thanks for the feedback. You are right. I agree that virtualenv is the most safest method at this time. Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

RE: pyinstaller wrong classified as Windows virus

2021-11-25 Thread Avi Gross via Python-list
something else entirely. -Original Message- From: Python-list On Behalf Of Ulli Horlacher Sent: Thursday, November 25, 2021 12:10 PM To: [email protected] Subject: Re: pyinstaller wrong classified as Windows virus Chris Angelico wrote: > Unfortunately, if you're not going

Re: Negative subscripts

2021-11-26 Thread Rob Cliffe via Python-list
y other techniques anyone can suggest, or is the only alternative to use if...then...else to cater for y = 0? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: pyinstaller wrong classified as Windows virus

2021-11-28 Thread Tony Flury via Python-list
Have you tried using Nuitka - rather than pyInstalller - it means you distribute a single executable and the Python run time library (which they probably have already), and it has the advantage that it is a bit quicker than standard python. Rather than bundle the source code and interpreter

Python child process in while True loop blocks parent

2021-11-29 Thread Jen Kris via Python-list
I have a C program that forks to create a child process and uses execv to call a Python program.  The Python program communicates with the parent process (in C) through a FIFO pipe monitored with epoll().  The Python child process is in a while True loop, which is intended to keep it running

Re: Python child process in while True loop blocks parent

2021-11-29 Thread Jen Kris via Python-list
Thanks to you and Cameron for your replies.  The C side has an epoll_ctl set, but no event loop to handle it yet.  I'm putting that in now with a pipe write in Python-- as Cameron pointed out that is the likely source of blocking on C.  The pipes are opened as rdwr in Python because t

Re: Python child process in while True loop blocks parent

2021-12-01 Thread Jen Kris via Python-list
Thanks for your comment re blocking.  I removed pipes from the Python and C programs to see if it blocks without them, and it does.  It looks now like the problem is not pipes.  I use fork() and execv() in C to run Python in a child process, but the Python process blocks because fork() does

Re: A decade or so of Python programming, and I've never thought to "for-elif"

2021-12-01 Thread Rob Cliffe via Python-list
print("Found!") break elif name.isupper(): print("All-caps name that wasn't found") This actually doesn't work. I have been programming in Python for well over a decade, and never before been in a situation where this would be useful. As YAGNIs go, this is right u

ANN: A new library for encryption and signing has been released.

2021-12-05 Thread Vinay Sajip via Python-list
A new library called pagesign (Python-age-sign) has been released on PyPI [1]. It covers similar functionality to python-gnupg, but uses the modern encryption tool age [2] and the modern signing tool minisign [3]. The initial release allows you to: * Create and manage identities (which are

Re: Python child process in while True loop blocks parent

2021-12-05 Thread Jen Kris via Python-list
Thanks for your comments.  I put the Python program on its own pthread, and call a small C program to fork-execv to call the Python program as a child process.  I revised the Python program to be a multiprocessing loop using the Python multiprocessing module.  That bypasses the GIL and allows

Re: Python child process in while True loop blocks parent

2021-12-05 Thread Jen Kris via Python-list
By embedding, I think you may be referring to embedding Python in a C program with the Python C API.   That's not what I'm doing here -- I'm not using the Python C API.  The C program creates two threads (using pthreads), one for itself and one for the child process.  On creat

python list files and folder using tkinter

2021-12-05 Thread Pascal B via Python-list
Hello, I have already posted a message some time ago for this app. Since then, I didn't code in python or made any changes. I think before getting further with functionnalities a few things or the whole thing need to be changed. For exemple, it would need a button to pick folders and mayb

Re: Python child process in while True loop blocks parent

2021-12-06 Thread Jen Kris via Python-list
t;).  You may be confused by the fact that threads are called light-weight processes.  Or maybe I'm confused :) If you have other information, please let me know.  Thanks.  Jen Dec 5, 2021, 18:08 by [email protected]: > On 2021-12-06 00:51:13 +0100, Jen Kris via Python-list wrote: >

Re: Python child process in while True loop blocks parent

2021-12-06 Thread Jen Kris via Python-list
@barrys-emacs.org: > > >> On 6 Dec 2021, at 17:09, Jen Kris via Python-list >> wrote: >> >> I can't find any support for your comment that "Fork creates a new >> process and therefore also a new thread." From the Linux man pages >> htt

Re: Return

2021-12-07 Thread Roland Mueller via Python-list
Hello ti 7. jouluk. 2021 klo 19.47 vani arul ([email protected]) kirjoitti: > Hey There, > Can someone help to understand how a python function can return value with > using return in the code? > It is not not about explicit or implicit function call. > > Not sure whether

Re: HTML extraction

2021-12-07 Thread Roland Mueller via Python-list
ions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags > > > Can xpath / lxml do that? > > > > What are the chief differences between xpath / lxml and Beautiful Soup? > > > > I've never directly used lxml, mainly because bs4 offers all the same > ad

Re: Python child process in while True loop blocks parent

2021-12-08 Thread Jen Kris via Python-list
nyone has a better solution I would appreciate any feedback.  To recap, I'm using a pair of named pipes for IPC between C and Python.  Python runs as a child process after fork-execv.  The Python program continues to run concurrently in a while True loop, and responds to requests from C at

ANN: distlib 0.3.4 released on PyPI

2021-12-08 Thread Vinay Sajip via Python-list
gs in get_distributions() if bad metadata seen, but keep   going. * Fixed #154: Determine Python versions correctly for Python >= 3.10. * Updated launcher executables with changes to handle duplication logic. Code relating to support for Python 2.6 was also removed (support for Python 2.6 was dropped in an

Re: Short, perfect program to read sentences of webpage

2021-12-08 Thread Jon Ribbens via Python-list
this very wrongly. Python has plenty of open source libraries you can use that will parse the HTML reliably into tags and text for you. > 2. Neither is the segmentation perfect. I am currently researching > developing an optimal segmenter with tools from Spacy. > > Brevity is greatly v

Re: Return

2021-12-09 Thread Roland Müller via Python-list
key==a[med]:     return med     elif key>a[med]:     l=med+1/ /      elif keyBut in the following block,how does it return values if there is no return specified? First of all please reply always to the list address! If Python does not encounter a return statement i

Isn't TypeError built in?

2021-12-12 Thread Mike Dewhirst via Python-list
58944] AH00489: Apache/2.4.41 (Ubuntu) SVN/1.13.0 OpenSSL/1.1.1f mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations [Mon Dec 13 01:15:49.885664 2021] [core:notice] [pid 1033:tid 140446449658944] AH00094: Command line: '/usr/sbin/apache2' Exception ignored in: Traceba

Re: Isn't TypeError built in?

2021-12-13 Thread Mike Dewhirst via Python-list
On 13/12/2021 12:42 pm, Chris Angelico wrote: On Mon, Dec 13, 2021 at 12:31 PM Mike Dewhirst via Python-list wrote: Obviously something is wrong elsewhere but I'm not sure where to look. Ubuntu 20.04 with plenty of RAM. def __del__(self): try: for context_o

Re: Advanced ways to get object information from within python

2021-12-23 Thread Robert Latest via Python-list
selector', 'signals', 'spiders', 'twisted_version', > 'utils', 'version_info'] > > I wish there was a convenient way for me to know what all of these are. ['%s: %s' % (x, type(getattr(scrapy, x))) for x in dir(scrapy)] -- https://mail.python.org/mailman/listinfo/python-list

Re: Isn't TypeError built in?

2021-12-25 Thread Mike Dewhirst via Python-list
s and describe it.Fyi, there was nothing out of kilter in the machine. It was in production and is stable.CheersMike--(Unsigned mail from my phone) Original message From: "Peter J. Holzer" Date: 26/12/21 06:19 (GMT+10:00) To: [email protected] Subject: Re:

RE: recover pickled data: pickle data was truncated

2021-12-29 Thread Avi Gross via Python-list
checking it. But corruption can happen for many reasons including at the level of the disk it is written to. -Original Message- From: Python-list On Behalf Of iMath Sent: Wednesday, December 29, 2021 10:51 AM To: [email protected] Subject: Re: recover pickled data: pickle data was

RE: builtins.TypeError: catching classes that do not inherit from BaseException is not allowed

2021-12-30 Thread Avi Gross via Python-list
right one or ... Many machines simply restrict you to compare numbers only up to the point where an int or float of some kind support it and then the operation of comparison is mostly just done in a few steps in the hardware no matter what size the two things are. Python with support for unlimited size

RE: builtins.TypeError: catching classes that do not inherit from BaseException is not allowed

2021-12-31 Thread Avi Gross via Python-list
You can design tree structures in ways that allow them to be traversed in an iterative way such as having bi-directional links along with flags that mark where you entered a node from or already visited. Tools should be tools, not religions. -Original Message----- From: Python-list On Be

Re: What to write or search on github to get the code for what is written below:

2022-01-07 Thread Avi Gross via Python-list
This entire thread seems a bit IFFY to me. It does seme like HW to me but also a bit peripheral. The fact that the data is in EXCEL is a detail. And unless a spreadheet is complex, it may be trivial to save the file as a .CSV and from then on read from there into Python (or anything) and when

Extracting dataframe column with multiple conditions on row values

2022-01-07 Thread Mahmood Naderan via Python-list
there any way to use built-in function for a more efficient code? Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: Extracting dataframe column with multiple conditions on row values

2022-01-08 Thread Avi Gross via Python-list
: "what it the item in row/address 2 of the column that somewhere contains two additional specified contents called key1 and key2"  My guess is that if the instructor wanted this to be solved using methods being taught, then loops may well be a way to go. Python and numpy/pandas make it often

Re: What to write or search on github to get the code for what is written below:

2022-01-09 Thread Avi Gross via Python-list
start with, that may be lots of extra work. And it is not python alone what might require work but other languages like R too.  Perhaps I missed a better description of the design. -Original Message- From: Dennis Lee Bieber To: [email protected] Sent: Sun, Jan 9, 2022 1:08 pm Subject

Re: What to write or search on github to get the code for what is written below:

2022-01-13 Thread Avi Gross via Python-list
I am not replying to anything below so I have removed it. So I need to remind people of the topic and how it has wandered. Someone has data in a not particularly great format in an EXCEL spreadsheet. They want to somehow use an external language like Python to manipulate the contents from

Re: keep getting a syntax error on the very first program I am running

2022-01-14 Thread Jon Ribbens via Python-list
On 2022-01-15, Bob Griffin wrote: >I am running this program and keep getting this error. Is this normal? > >Invalid syntax. Perhaps you forgot a comma? > >Also the t in tags is highlighted. > >I even tried different versions of Python also. > >

Writing a string with comma in one column of CSV file

2022-01-15 Thread Mahmood Naderan via Python-list
x27;,' and this causes the final CSV file to have more than 2 columns, while I want to write the whole key as a single column. I know that wr.writerow([key]) writes the entire key in one column, but I would like to do the same with write(). Any idea to fix that? Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: What to write or search on github to get the code for what is written below:

2022-01-15 Thread Avi Gross via Python-list
Mats, Yes, this is a Python mailing list and I welcome people interested in doing something in Python who need a little help or advice but have some idea of what they are doing and present us with enough info more than "something does not work." Yes, the topic was raised on a Python

Re: Writing a string with comma in one column of CSV file

2022-01-15 Thread Mahmood Naderan via Python-list
Right. I was also able to put all columns in a string and then use writerow(). Thanks. Regards, Mahmood On Saturday, January 15, 2022, 10:33:08 PM GMT+1, alister via Python-list wrote: On Sat, 15 Jan 2022 20:56:22 + (UTC), Mahmood Naderan wrote: > Hi, > I use the fol

Re: Writing a string with comma in one column of CSV file

2022-01-15 Thread Avi Gross via Python-list
symbols to delimit data and may be saved with names like a .TSV file or others. Python can trivially read in such files often simply by telling it to read something like a CSV but specifying the field separator is a tab or some other character. But I have another dumb question. Why are you writing your

Re: What to write or search on github to get the code for what is written below:

2022-01-17 Thread Avi Gross via Python-list
ways perhaps never intended. Obviously, feeling urgency to do something quickly will make it hard to accept our suggestions, but nonetheless, a request here, as has been pointed out, should anticipate a python-oriented answer. Asking us here to make a set of macros for EXCEL to do this task would

Trouble downloading Python

2022-01-18 Thread Renda Saptoe via Python-list
Good day, I am experiencing issues trying to download Python. I would please need some assistance to help download the progam to my laptop. Kind regards Renda -- https://mail.python.org/mailman/listinfo/python-list

Re: What to write or search on github to get the code for what is written below:

2022-01-18 Thread Avi Gross via Python-list
I do not manage any python lists or have any say in how they run so I have no idea why I am being asked by name below, as Dennis pointed out. So I won't reply on whatever I am being asked, but want to point out that many forums may be asked questions and some people on the forum will not re

Puzzling behaviour of Py_IncRef

2022-01-19 Thread Tony Flury via Python-list
I am attaching a 2nd nodes to each other, and the live code therefore increments the ref-count for both objects - so even if the Python code deletes it's reference the reference count for the instance should still be 1 in order to ensure it doesn't get garbage collected./ This fu

Re: Puzzling behaviour of Py_IncRef

2022-01-19 Thread Tony Flury via Python-list
On 19/01/2022 11:09, Chris Angelico wrote: On Wed, Jan 19, 2022 at 10:00 PM Tony Flury via Python-list wrote: Extension function : static PyObject *_Node_test_ref_count(PyObject *self) { printf("\nIncrementing ref count for self - just for the hell of

"undefined symbol" in C extension module

2022-01-22 Thread Robert Latest via Python-list
lib.linux-x86_64-3.10/ spam.cpython-310-x86_64-linux-gnu.so) [and more of the same] It seems that I need to install some library to make this work, but which one? -- https://mail.python.org/mailman/listinfo/python-list

Re: What to write or search on github to get the code for what is written below:

2022-01-22 Thread Avi Gross via Python-list
I keep wondering about the questions asked by NArshad here. His message can be read below mine, for context. This is a place focused on using the Python language. The web page being in HTML is beyond irrelevant and in particular, web pages generally are in HTML even if only as a way to call

Re: "undefined symbol" in C extension module

2022-01-23 Thread Robert Latest via Python-list
Dan Stromberg wrote: > Perhaps try: > https://stromberg.dnsalias.org/svn/find-sym/trunk > > It tries to find symbols in C libraries. > > In this case, I believe you'll find it in -lpythonx.ym Thanks! Found out that ldd produces many errors also with working python librarie

Re: Pandas or Numpy

2022-01-23 Thread Avi Gross via Python-list
to select some subset of rows will use things like  a data structure holding the integer indexes you want or a boolean where True means take it and False means ignore it.  Many real life applications just incorporate both numpy as np and pandas as pd and sometimes also use other Python

Re: Puzzling behaviour of Py_IncRef

2022-01-25 Thread Tony Flury via Python-list
h, I wasn't clear there. It was equivalent to *the Python code* "return self". My apologies. > The normal thing to do is to add a reference to whatever you're > returning. For instance, Py_RETURN_NONE will incref None and then > return it. > The OP understa

Re: Puzzling behaviour of Py_IncRef

2022-01-25 Thread Tony Flury via Python-list
On 25/01/2022 22:28, Barry wrote: On 25 Jan 2022, at 14:50, Tony Flury via Python-list wrote:  On 20/01/2022 23:12, Chris Angelico wrote: On Fri, 21 Jan 2022 at 10:10, Greg Ewing wrote: On 20/01/22 12:09 am, Chris Angelico wrote: At this point, the refcount has indeed been increased

Re: Puzzling behaviour of Py_IncRef

2022-01-26 Thread Tony Flury via Python-list
On 26/01/2022 01:29, MRAB wrote: On 2022-01-25 23:50, Tony Flury via Python-list wrote: On 25/01/2022 22:28, Barry wrote: On 25 Jan 2022, at 14:50, Tony Flury via Python-list  wrote:  On 20/01/2022 23:12, Chris Angelico wrote: On Fri, 21 Jan 2022 at 10:10, Greg Ewing  wrote: On 20/01

Re: Puzzling behaviour of Py_IncRef

2022-01-26 Thread Tony Flury via Python-list
On 26/01/2022 08:20, Chris Angelico wrote: On Wed, 26 Jan 2022 at 19:04, Tony Flury via Python-list wrote: So according to that I should increment twice if and only if the calling code is using the result - which you can't tell in the C code - which is very odd behaviour. No, the r

Re: Puzzling behaviour of Py_IncRef

2022-01-26 Thread Tony Flury via Python-list
On 26/01/2022 22:41, Barry wrote: Run python and your code under a debugger and check the ref count of the object as you step through the code. Don’t just step through your code but also step through the C python code. That will allow you to see how this works at a low level. Setting a

Re: Starting using Python

2022-01-27 Thread Tony Flury via Python-list
On 03/01/2022 12:45, Joao Marques wrote: Good morning: I have a very simple question: I want to start writing programs in Python so I went to the Microsoft Store and installed Python3.9. No problem so far. I would prefer to have a gui interface, an interface that I can use file-->Open and F

Data unchanged when passing data to Python in multiprocessing shared memory

2022-02-01 Thread Jen Kris via Python-list
I am using multiprocesssing.shared_memory to pass data between NASM and Python.  The shared memory is created in NASM before Python is called.  Python connects to the shm:  shm_00 = shared_memory.SharedMemory(name='shm_object_00',create=False).  I have used shared memory at other

Re: Data unchanged when passing data to Python in multiprocessing shared memory

2022-02-01 Thread Jen Kris via Python-list
Barry, thanks for your reply.  On the theory that it is not yet possible to pass data from a non-Python language to Python with multiprocessing.shared_memory, I bypassed the problem by attaching 4 bytes to my FIFO pipe message from NASM to Python: byte_val = v[10:14] where v is the message

Re: Data unchanged when passing data to Python in multiprocessing shared memory

2022-02-02 Thread Avi Gross via Python-list
m: Dennis Lee Bieber To: [email protected] Sent: Wed, Feb 2, 2022 12:30 am Subject: Re: Data unchanged when passing data to Python in multiprocessing shared memory On Wed, 2 Feb 2022 00:40:22 +0100 (CET), Jen Kris declaimed the following: > > breakup = int.from_bytes(byte_va

Re: Data unchanged when passing data to Python in multiprocessing shared memory

2022-02-02 Thread Jen Kris via Python-list
Feb 1, 2022, 21:30 by [email protected]: > On Wed, 2 Feb 2022 00:40:22 +0100 (CET), Jen Kris > declaimed the following: > >> >> breakup = int.from_bytes(byte_val, "big") >> > >print("this is breakup " + str(breakup)) > >> >> >

Re: Data unchanged when passing data to Python in multiprocessing shared memory

2022-02-02 Thread Jen Kris via Python-list
An ASCII string will not work.  If you convert 32894 to an ascii string you will have five bytes, but you need four.  In my original post I showed the C program I used to convert any 32-bit number to 4 bytes.  Feb 2, 2022, 10:16 by [email protected]: > I applaud trying to find the ri

Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
ning = False -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
cessary, but if you want a good Pythonic way to show > the beginning and end of its use area, a 'with' block is the way to > go.) I will look into that. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
s_running = True self._next() def stop(self): if self._is_running: self._timer.cancel() self._timer = None self._is_running = False -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Data unchanged when passing data to Python in multiprocessing shared memory

2022-02-02 Thread Avi Gross via Python-list
aside and the string use a null terminator if shorter. Of course if this big-endian issue also scrambles bytes used in strings, forget it. Or, maybe shared memory is not the easy way to go, even it it might be faster. -Original Message- From: Jen Kris To: Avi Gross Cc: python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
nce(interval, (int,float)): > > which handles subclasses of these types (but note that bool subclasses > int :-) Done, thanks. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
e > default; you don't need to say "class X(object)"), which will > automatically give your object all the methods of a timer. Of-course. I should have thought about that. :'-( -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
ng? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
> self._next() > self._is_running = True > > def stop(self): > if self._is_running: > self._timer.cancel() > self._timer = None > self._is_running = False -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Thu, 3 Feb 2022 at 15:43, Cecil Westerhof via Python-list > wrote: >> >> Chris Angelico writes: >> >> >> > (Side point: The OP's code is quite inefficient, as it creates a new >> >> > thread for each reitera

Re: Waht do you think about my repeated_timer class

2022-02-03 Thread Cecil Westerhof via Python-list
Barry writes: >> On 3 Feb 2022, at 04:45, Cecil Westerhof via Python-list >> wrote: >> >> Have to be careful that timing keeps correct when target takes a 'lot' >> of time. >> Something to ponder about, but can wait. > > You have noticed

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
name … The class starts a thread where every by the user defined interval a by the user define function is called. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
Ethan Furman writes: > On 2/4/22 6:28 AM, Cecil Westerhof via Python-list wrote: > >> It was already not a good name, but I am rewriting the class >> completely, so now the name is a complete bumper. (No more timer.) I >> am thinking about naming the class repeating_

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
Igor Berger writes: > On Friday, February 4, 2022 at 12:28:53 PM UTC-5, Cecil Westerhof wrote: >> Ethan Furman writes: >> >> > On 2/4/22 6:28 AM, Cecil Westerhof via Python-list wrote: >> > >> >> It was already not a good name, but I am rewriting

RuntimeError, or user defined exception

2022-02-04 Thread Cecil Westerhof via Python-list
Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Sat, 5 Feb 2022 at 04:33, Cecil Westerhof via Python-list > wrote: >> >> Ethan Furman writes: >> >> > On 2/4/22 6:28 AM, Cecil Westerhof via Python-list wrote: >> > >> >> It was already not a good name, but I am

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Avi Gross via Python-list
time_after_time But to be more pythonic, throw some double underscores before and after. -Original Message- From: Igor Berger To: [email protected] Sent: Fri, Feb 4, 2022 12:40 pm Subject: Re: Waht do you think about my repeated_timer class On Friday, February 4, 2022 at 12:28:53

Re: Openning Python program

2022-02-07 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Tue, 8 Feb 2022 at 02:53, Grant Edwards wrote: >> >> On 2022-02-06, Dennis Lee Bieber wrote: >> > On Sun, 6 Feb 2022 13:44:07 +0530, "[email protected]" >> > declaimed the following: >> > >> >

Re: Openning Python program

2022-02-07 Thread Cecil Westerhof via Python-list
t his little experiment showed. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Openning Python program

2022-02-08 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Tue, 8 Feb 2022 at 06:51, Cecil Westerhof via Python-list > wrote: >> >> Chris Angelico writes: >> >> >> > How difficult would it be to get people to read those lines, though? >> >> >> >> That d

Can't get iterator in the C API

2022-02-08 Thread Jen Kris via Python-list
I am using the Python C API to load the Gutenberg corpus from the nltk library and iterate through the sentences.  The Python code I am trying to replicate is: from nltk.corpus import gutenberg for i, fileid in enumerate(gutenberg.fileids()):     sentences = gutenberg.sents(fileid

Re: Kind Remainder: How do Practitioners Approach towards Requirements Engineering?

2022-02-08 Thread Avi Gross via Python-list
Is there any way to get this mesage to stop showing up in my mailbox in what seems to be a shotgun approach asking everybody everywhere they can think of to participate in something very amorphous and at the same time having NOTHING particular to do with Python? I consider things like this SPAM

Re: Can't get iterator in the C API

2022-02-09 Thread Jen Kris via Python-list
Thank you for clarifying that.  Now on to getting the iterator from the method.  Jen Feb 8, 2022, 18:10 by [email protected]: > On 2022-02-09 01:12, Jen Kris via Python-list wrote: > >> I am using the Python C API to load the Gutenberg corpus from the nltk >> l

C API PyObject_Call segfaults with string

2022-02-09 Thread Jen Kris via Python-list
This is a follow-on to a question I asked yesterday, which was answered by MRAB.   I'm using the Python C API to load the Gutenberg corpus from the nltk library and iterate through the sentences.  The Python code I am trying to replicate is: from nltk.corpus import gutenberg for i, file

Re: C API PyObject_Call segfaults with string

2022-02-09 Thread Jen Kris via Python-list
/vrut/python/ext/buildValue.html, PyBuildValue "builds a tuple only if its format string contains two or more format units" and that doc contains examples.  Feb 9, 2022, 16:52 by [email protected]: > On Thu, Feb 10, 2022 at 9:42 AM Jen Kris via Python-list > wrote: >

Re: C API PyObject_Call segfaults with string

2022-02-09 Thread Jen Kris via Python-list
he one to use. According >> to http://web.mit.edu/people/amliu/vrut/python/ext/buildValue.html, >> PyBuildValue "builds a tuple only if its format string contains two or more >> format units" and that doc contains examples. >> > > Yes, and PyObject

Re: C API PyObject_Call segfaults with string

2022-02-09 Thread Jen Kris via Python-list
I'm using Python 3.8 so I tried your second choice: pSents = PyObject_CallFunctionObjArgs(pSentMod, pListItem); but pSents is 0x0.  pSentMod and pListItem are valid pointers.  Feb 9, 2022, 17:23 by [email protected]: > // https://docs.python.org/3/c-api/call.html#c.PyObject_Ca

Re: Best way to check if there is internet?

2022-02-09 Thread Avi Gross via Python-list
using a cryptographic method might be better. -Original Message- From: Abdur-Rahmaan Janhangeer To: Python Sent: Wed, Feb 9, 2022 12:24 pm Subject: Re: Best way to check if there is internet? > This won't work if you're behind a captive portal: every URL you try to get will ret

Re: C API PyObject_Call segfaults with string

2022-02-09 Thread Jen Kris via Python-list
I'll do that and post back tomorrow.  The office is closing and I have to leave now (I'm in Seattle).  Thanks again for your help.  Feb 9, 2022, 17:40 by [email protected]: > On Thu, Feb 10, 2022 at 10:37 AM Jen Kris wrote: > >> >> I'm using Python

Re: Global VS Local Subroutines

2022-02-10 Thread Rob Cliffe via Python-list
things. But of course, performance is not the only consideration, as per Chris Angelico's answer. Best wishes Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: C API PyObject_Call segfaults with string

2022-02-10 Thread Jen Kris via Python-list
om PyErr_Print.  I'm not far enough along in my C_API work to understand why, but it doesn't work.  Thanks very much for your help on this.  Jen Feb 9, 2022, 17:40 by [email protected]: > On Thu, Feb 10, 2022 at 10:37 AM Jen Kris wrote: > >> >> I

Re: C API PyObject_Call segfaults with string

2022-02-10 Thread Jen Kris via Python-list
erday.  Thanks much for your help. Jen Feb 9, 2022, 18:43 by [email protected]: > On 2022-02-10 01:37, Jen Kris via Python-list wrote: > >> I'm using Python 3.8 so I tried your second choice: >> >> pSents = PyObject_CallFunctionObjArgs(pSentMod, pListItem); >

Re: C API PyObject_Call segfaults with string

2022-02-10 Thread Jen Kris via Python-list
Thank you for that suggestion.  It allowed me to replace six lines of code with one.  :) Feb 10, 2022, 12:43 by [email protected]: > On 2022-02-10 20:00, Jen Kris via Python-list wrote: > >> With the help of PyErr_Print() I have it solved.  Here is the final code

Re: Global VS Local Subroutines

2022-02-10 Thread Rob Cliffe via Python-list
which circumstances. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to solve the given problem?

2022-02-10 Thread Avi Gross via Python-list
: NArshad To: [email protected] Sent: Thu, Feb 10, 2022 1:40 am Subject: How to solve the given problem? Assume that there is a pattern of feeding for a special fish in a day (10 hours a day) as below:                               150    100    30    30    30    20    20    10    5    5

C API - How to return a Dictionary as a Dictionary type

2022-02-14 Thread Jen Kris via Python-list
I created a dictionary with the Python C API and assigned two keys and values: PyObject* this_dict = PyDict_New();  const char *key = "key1"; char *val = "data_01";  PyObject* val_p = PyUnicode_FromString(val);  int r = PyDict_SetItemString(this_dict, key, val_p);  // Add

Re: C API - How to return a Dictionary as a Dictionary type

2022-02-14 Thread Jen Kris via Python-list
Yes, that works.  This is my first day with C API dictionaries.  Now that you've explained it, it makes perfect sense.  Thanks much.  Jen Feb 14, 2022, 17:24 by [email protected]: > On Tue, 15 Feb 2022 at 12:07, Jen Kris via Python-list > wrote: > >> >> I created a

Re: Long running process - how to speed up?

2022-02-19 Thread Avi Gross via Python-list
line at a time in Python and parse it by comma and any other processing and act on one row at a time or in small batches so you never need huge amounts of memory. But using other methods to read in the entire set of data is often better optimized and faster, and being able to do some things

Re: Why does not Python accept functions with no names?

2022-02-20 Thread Avi Gross via Python-list
od is odd and leaves it entirely out of the tables that keep track, you then would have a memory leak. -Original Message- From: Abdur-Rahmaan Janhangeer To: Chris Angelico Cc: Python Sent: Sun, Feb 20, 2022 12:27 pm Subject: Re: Why does not Python accept functions with no names? Thanks f

Re: Long running process - how to speed up?

2022-02-20 Thread Avi Gross via Python-list
Wichmann Cc: [email protected] Sent: Sun, Feb 20, 2022 1:05 pm Subject: Re: Long running process - how to speed up? On Sat, 19 Feb 2022 at 19:44, Mats Wichmann wrote: > On 2/19/22 05:09, Shaozhong SHI wrote: > > Can it be divided into several processes? > > Regards, > > Da

Re: Why does not Python accept functions with no names?

2022-02-20 Thread Avi Gross via Python-list
something you can create as say elements of a list so you have a list of functions you can access as in f[0] but in a sense that has a name as it can be accessed as a component of the data structure called f.  I am not sure if python would trivially let you create that. But the point is if you want to

Re: Why does not Python accept functions with no names?

2022-02-21 Thread Avi Gross via Python-list
could be caught would be accepted, even if teh resulting code was nonsense. Some languages use a real placeholder such as "_" (single underscore) to represent an I DON'T CARE scenario meaning I do not want to provide a name and Python allows code like: (a, _, c, _, e) = (1, 2, 3

Re: One-liner to merge lists?

2022-02-22 Thread Avi Gross via Python-list
7;, 'ccc'], ['fff', 'ggg']] As shown the list comprehension itself is not returning anything of value and need not be assigned to anything. But it then generally is set to autoprint and that can be supressed by assigning the value to _ or anything you can ignore. I

<    34   35   36   37   38   39   40   41   42   43   >