On 2022-04-19, Loris Bennett wrote:
> Jon Ribbens writes:
>> On 2022-04-19, Loris Bennett wrote:
>>> I now realise that timedelta is not really what I need. I am interested
>>> solely in pure periods, i.e. numbers of seconds,
>>
>> That's exactly what timedelta is.
>>
>>> that I can convert bac
On 2022-04-19, Loris Bennett wrote:
> If I am merely trying to represent part a very large number of seconds
> as a number of years, 365 days per year does not seem that controversial
> to me. Obviously there are issues if you expect all periods of an
> integer number of years which start on a gi
On 2022-04-19, Barry wrote:
>> On 19 Apr 2022, at 19:38, Dennis Lee Bieber wrote:
>> *I /think/ this is the year used for leap-day calculations, and
>> why some leap centuries are skipped as it is really less than a
>> quarter day per year, so eventually one gets to over-correcting
This does raise an issue, Chris, if you use the method of making a tuple
companion for a list at a specific time just for use as a dictionary key, then
later change the list, you can end up with various situations.
Obviously the changed list can not only not access the stored item, but if
conver
I have some scripts that are old and won't work under python2 and at the same
time I am writing new scripts which will use python3. However, if python 2 and
3 cannot co-exist in a windows box it will be impossible to transition
What I try:- remove all pythons and launchers- Use windows installer
nil
On Friday, April 22, 2022, 09:09:22 AM PDT, Sunil KR via Python-list
wrote:
I have some scripts that are old and won't work under python2 and at the same
time I am writing new scripts which will use python3. However, if python 2 and
3 cannot co-exist in a windows box it will
I don't use docstrings much; instead I put a line or two of comments
after the `def ` line.
But my practice in such situations is as per the OP's 3rd suggestion, e.g.
# Returns True if .
I'm curious as to why so many people prefer "Return" to "Returns".
Checking out help() on a few funct
Python does have a concept of "truthy" that includes meaning for not just the
standard Booleans but for 0 and non-zero and the empty string and many more odd
things such as an object that defines __bool__ ().
But saying it returns a Boolean True/False valuesounds direct and simple and
informativ
-Original Message-
From: MRAB
To: [email protected]
Sent: Fri, Apr 22, 2022 8:57 pm
Subject: Re: Style for docstring
On 2022-04-23 00:25, Rob Cliffe via Python-list wrote:
> I don't use docstrings much; instead I put a line or two of comments
> after the `def ` line.
> But
Given what you added, Michael, your function is part of a larger collection of
functions and being compatible with the others is a valid consideration.
Whatever you decide, would ideally be done consistently with all or most of
them.
And, of course, it others in the collection also can handle mu
, if I can make python 2 and 3
coexist on my system
> On 22 Apr 2022, at 17:10, Sunil KR via Python-list
wrote:
>
> I have some scripts that are old and won't work under python2 and at the
> same time I am writing new scripts which will use python3. However, if python
The question is not one of conversion. The question is this:
When I have both python 2 and python3, why is my python 2 script breaking? And
when I remove python3 the problem goes away?
In both cases (regardless of installing python 3 or not) I am using only python
2 to run the python2 script. W
I have been getting confused by how many interpretations and conditions for
chasing tail people seem to be talking about.
A fairly normal task is to want to see just the last N lines of a text-based
file.
A variant is the "tail -f" command from UNIX that continues to follow a growing
file, ofte
Yes, Michael, a dictionary is an excellent way to represent a closed set of
transitions which your permutations are.
You examples use numerals but obviously a dictionary will allow transformations
of anything that can be hashed which mostly is items that are not mutable.
Of course for the purpose
cd C:\google-python-exercises> python hello.py
this doesn't looks like a valid command. However, is it because a newline got
swallowed by misformatting?
For clarity, I am reproducing the correct version of the steps:
cd /d C:\google-python-exercises
python hello.py
The error is: The system c
Well, de gustibus non est disputandum. For me, the switch from the
imperative mode to the descriptive mode produces a mild cognitive
dissonance.
Best wishes
Rob Cliffe
On 25/04/2022 23:34, Cameron Simpson wrote:
On 23Apr2022 03:26, Avi Gross wrote:
We know some people using "professional" l
On 2022-04-28, Stephen Tucker wrote:
> Hi PythonList Members,
>
> Consider the following log from a run of IDLE:
>
>==
>
> Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
> on win32
> Type "copyright", "credits" or "license()" for more information.
p
On 28/04/2022 14:27, Stephen Tucker wrote:
To Cameron Simpson,
Thanks for your in-depth and helpful reply. I have noted it and will be
giving it close attention when I can.
The main reason why I am still using Python 2.x is that my colleagues are
still using a GIS system that has a Python pro
https://wiki.python.org/moin/PythonBooks
-Original Message-
From: Patrick 0511
To: [email protected]
Sent: Wed, May 4, 2022 9:36 pm
Subject: Python/New/Learn
Hello, I'm completely new here and don't know anything about python. Can
someone tell me how best to start? So what things
[email protected]
Sent: Wed, May 4, 2022 11:02 pm
Subject: Re: Python/New/Learn
On Thu, 5 May 2022 at 12:57, Avi Gross via Python-list
wrote:
>
> https://wiki.python.org/moin/PythonBooks
>
That's an incredibly daunting list, and not something I'd overly
strongly recommend, but yes, i
I agree Chris that the Ukrainian Python Books are daunting as I barely started
learning that language now even though my early years were just a few miles
away and I might even have relatives still there!
But as has been pointed out, suggestions are more helpful if you know a bit
more about the
Before more people reply to this user, I note I have not seen them reply back
to the list about any questions or comments others have taken the time to
provide.
My warning bells go off when I see patterns and there was a similar request
from another gmail account to an R language forum I am als
This topic has rapidly shifted over way beyond Python even as the original
person has not returned to participate.
There are many ways to teach anything and since the classical method was to
learn in person from someone using mainly sound or pantomime, it has hung on.
Even with the existence of
Marco,
I think it was made clear from the start that "text" files in the classic sense
have no random access method at any higher level than reading a byte at some
offset from the beginning of the file, or back from the end when it has not
grown.
The obvious fact is that most of the time the li
Just FYI, UNIX had a bunch of utilities that could emulate a vanilla version of
tail on a command line.
You can use sed, awk and quite a few others to simply show line N to the end of
a file or other variations.
Of course the way many things were done back then had less focus on efficiency
than
This seems to be a regular refrain where someone wants something as STANDARD in
a programming language or environment and others want to keep it lean and mean
or do not see THIS suggestion as particularly important or useful.
Looking at the end of something is extremely common. Packages like nump
Bryan,
As has been pointed out, it is very common in possibly all programming
languages to not allow digits at the start of many identifiers. It makes it
hard to parse for numbers which tend to start with digits. Some languages even
have special rules on not starting a number with a zero unless
... ❽ ❽
-Original Message-----
From: Avi Gross via Python-list
To: [email protected]
Sent: Fri, May 13, 2022 6:02 pm
Subject: Re: .0 in name
Bryan,
As has been pointed out, it is very common in possibly all programming
languages to not allow digits at the start of many identifiers. It
You left out 3CPO, Dave.
Names with numerals are not unreasonable in some circumstances.
But programming languages are not a full spectrum of real life. They can have
reserved words too so you may not be able to use "while" and if you choose to
create a function that masks another, you cannot c
I was shocked to discover that when repeatedly running the following
program (condensed from a "real" program) under Python 3.8.3
for p in { ('x','y'), ('y','x') }:
print(p)
the output was sometimes
('y', 'x')
('x', 'y')
and sometimes
('x', 'y')
('y', 'x')
Can anyone explain why running
On 16/05/2022 04:13, Dan Stromberg wrote:
On Sun, May 15, 2022 at 8:01 PM Rob Cliffe via Python-list
wrote:
I was shocked to discover that when repeatedly running the following
program (condensed from a "real" program) under Python 3.8.3
for p in { ('x
Thanks, Paul. Question answered!
Rob Cliffe
On 16/05/2022 04:36, Paul Bryan wrote:
This may explain it:
https://stackoverflow.com/questions/27522626/hash-function-in-python-3-3-returns-different-results-between-sessions
On Mon, 2022-05-16 at 04:20 +0100, Rob Cliffe via Python-list wrote
On 2022-05-18, ^Bart wrote:
> THE INPUT
> -
> import nmap
> nm.scan(hosts='192.168.205.0/24', arguments='-n -sP -PE -PA21,23,80,3389')
> hosts_list = [(x, nm[x]['status']['state']) for x in nm.all_hosts()]
> for host, status i
What Changed?
=
This is an enhancement and bug-fix release, and all users are encouraged to
upgrade.
Brief summary:
* Fixed #161: Added a status attribute to the returned object from gen_key()
which
is set to 'ok' if a key was successfully created, or 'key not created' if that
wa
invest_crypto.client_list.append(self)
I am wondering about the phrasing above.
When you are in the dunder init function, you normally create and change items
in YOURSELF so why is your code not changing self.crypto_client_list?
And what are you appending to before ever creating it? Would it k
Good day
I am new to programming. I have signed up for a virtual online course and
installed Python using Anaconda as well as jupyter notebook. I encountered
problems & then went to YouTube tried going directly to the python website and
used Pycharm. When I used pycharm and try to run the first
Amazing how some people bring out the heavy artillery, first! LOL!
If the question was how to remove any initial digits and perhaps whitespace in
a string, it is fairly easy to do without any functions to test if there are
digits before the title. I mean look at initial characters and move forwa
On 2022-06-08, Dave wrote:
> I misunderstood how it worked, basically I’ve added this function:
>
> def filterCommonCharacters(theString):
> myNewString = theString.replace("\u2019", "'")
> return myNewString
> Which returns a new string replacing the common characters.
>
> This can easil
Dave,
Your goal is to compare titles and there can be endless replacements needed if
you allow the text to contain anything but ASCII.
Have you considered stripping out things instead? I mean remove lots of stuff
that is not ASCII in the first place and perhaps also remove lots of extra
punctu
Dave,
Sometimes a task is done faster by NOT programming anything in any language!
Not only have you spent a lot of your own time but many dozens of messages here
have dragged in others, who gain nothing ;-)
The domain you are operating in seems to have lots of variants in how the
titles are s
On Tuesday, March 8, 2022 at 12:52:29 PM UTC-6, Shaozhong SHI wrote:
> The following warning kept coming up when running ogr2ogr.
>
> Warning 1: Missing global # gdal: DRIVER_NAME declaration in
> C:\Users\AppData\Local\Programs\Python\Python36\Lib\site-packages\osgeo\gdal_array.py
>
>
> What
Dave,
Despite your other programming knowledge, I suspect you think this is the forum
where people come to be tutored. Try here:
https://mail.python.org/mailman/listinfo/tutor
Yes, there are plenty of pretty printers available and you can build your own
function fairly easily. A module like pp
I wish this discussion was simplified.
It sounds to me like what is wanted is a way to PRINT a filled-out form using
some dynamic text that fits over designated slots in the data. It is not that
different from many other tasks where you overlay some graphics with text.
You need a decent version o
Dude, it's called CPython for a reason.
--
https://mail.python.org/mailman/listinfo/python-list
This leads to the extremely important question of what would an implementation
of Python, written completely in C++, be called?
C++Python
CPython++
C+Python+
DPython
SeaPython?
SeeSeaSiPython
I don't even want to think fo what sound a C# Python would make.
OK, my apologies to all. Being an inter
If we want to be humorous, RPython would obviously either be written in R,
which really is not designed well for such purposes, or would be some kind of
synthesis that already exists that allows you to run R and python code
interchangeably on sort of shared data that I sometimes do in RSTUDIO.
David,
I am curious why you are undertaking the effort to take a language already
decades old and showing signs of being a tad rusty into a language that
suggests further oxidation.
More seriously, I am interested in what this can gain and the intended user
base. I studied Rust for a while and i
David,
I understand now. As a project for your own edification I can understand it,
albeit it is a more substantial effort than many people might choose, LOL!
So unless it starts being used heavily and adopted by some organization, the
result of your effort will not necessarily be compatible with
This 2-line program
def f(): pass
def g(): pass
runs silently (no Exception). But:
23:07:02 c:\>python
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(): pass
... d
On 2022-06-26, Rob Cliffe wrote:
> This 2-line program
>
> def f(): pass
> def g(): pass
>
> runs silently (no Exception). But:
>
> 23:07:02 c:\>python
> Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "lic
On 26/06/2022 23:22, Jon Ribbens via Python-list wrote:
On 2022-06-26, Rob Cliffe wrote:
This 2-line program
def f(): pass
def g(): pass
runs silently (no Exception). But:
23:07:02 c:\>python
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
bit (Intel)] on wi
I have an application in which I wanted a fixed-length "array of bytes"
(that's intended as an informal term) where I could read and write
individual bytes and slices, and also pass the array to a DLL (one I
wrote in C) which expects an "unsigned char *" parameter.
I am using ctypes to talk to t
That worked. Many thanks Eryk.
Rob
On 30/06/2022 23:45, Eryk Sun wrote:
On 6/30/22, Rob Cliffe via Python-list wrote:
AKAIK it is not possible to give ctypes a bytearray object and persuade
it to give you a pointer to the actual array data, suitable for passing
to a DLL.
You're overlo
Nati Stern has asked several questions here, often about relatively technical
uses of python code that many of us have never used and still is not providing
more exact info that tends to be needed before anyone can even think of
diagnosing the problem.
I have learned to stay away from some such
Nati,
This is a two-way process and requires you to be very clear on what is not
working or what you are trying to do or help clear away having us try to
understand lots of code that is not very related to the question.
Your code, as shown, makes an empty string repeatedly in a loop.
a=dict()
I
I've recently released version 0.3.5 of distlib on PyPI [1]. For newcomers,
distlib is a library of packaging functionality which is intended to be
usable as the basis for third-party packaging tools.
The main changes in this release are as follows:
* Fixed #161: Updated test case.
* Fixed #164:
In the last 10 years of my working life I worked as a freelancer, as a
specialist in Microsoft Access, at Interpolis-Tilburg, Rabobank-Zeist,
Abn-Amro-Amsterdam and the SVB in Amstelveen, among others.
From 1999 onward, I developed an accounting program in Microsoft Access
for myself, Boeket,
I need to get a random integer. At first I tried it with:
from secrets import randbelow
index = randbelow(len(to_try))
This works perfectly, but it took some time. So I thought I try:
from random import SystemRandom
index = SystemRandom().randint(0, len(to_try) - 1)
A first indic
Chris Angelico writes:
> On Wed, 27 Jul 2022 at 01:06, Cecil Westerhof via Python-list
> wrote:
>>
>> I need to get a random integer. At first I tried it with:
>> from secrets import randbelow
>> index = randbelow(len(to_try))
>>
>> This wo
Chris Angelico writes:
> On Wed, 27 Jul 2022 at 06:06, Cecil Westerhof via Python-list
> wrote:
>>
>> Chris Angelico writes:
>>
>> > On Wed, 27 Jul 2022 at 01:06, Cecil Westerhof via Python-list
>> > wrote:
>> >>
>> >> I need
Barry writes:
>> On 26 Jul 2022, at 16:07, Cecil Westerhof via Python-list
>> wrote:
>>
>> I need to get a random integer. At first I tried it with:
>>from secrets import randbelow
>>index = randbelow(len(to_try))
>>
>> This works perf
"Michael F. Stemper" writes:
> This is orthogonal to your question, but might be of some use to you:
>
> The combination of using len(to_try) as an argument to randint() and
> saving the output to a variable named "index" suggests that you might
> be setting up to select a random element from to_
[email protected] (Stefan Ram) writes:
> Cecil Westerhof writes:
>>values = [*range(100)]
>
> In many cases, any iterable is just fine and a list is not
> required, just as peudo-random numbers often are just fine and
> real-world entropy is not required.
In this case both are. I mus
Chris Angelico writes:
> On Wed, 27 Jul 2022 at 08:18, Cecil Westerhof via Python-list
> wrote:
>>
>> Chris Angelico writes:
>>
>> > On Wed, 27 Jul 2022 at 06:06, Cecil Westerhof via Python-list
>> > wrote:
>> >>
>> >> Chris A
Chris Angelico writes:
> Incidentally - if you are actually trying to select a specific item,
> you may want to consider random.choice.
Yes, I try to select a random element, but it has also to be removed.
An element should be used at most once. This is the code I use:
# index = randbelow(le
Dennis Lee Bieber writes:
> On Tue, 26 Jul 2022 23:47:59 +0200, Cecil Westerhof
> declaimed the following:
>
>
>>The new code:
>>from random import SystemRandom
>>system_random = SystemRandom()
>>index = system_random.randint(0, len(to_try) - 1)
>>
>>The first two statements are e
It is not very important, but I am just curious.
Original I had in a program:
values = [*range(100)]
But because it is done quite often I expected that initialising:
range_list = [*range(100)]
and then use:
values = range_list.copy()
Would be more efficient. So I tried:
Dennis Lee Bieber writes:
> On Wed, 27 Jul 2022 10:45:47 +0200, Cecil Westerhof
> declaimed the following:
>
>
>>What do you mean with where the python version is from?
>
> Base Python.org download, ActiveState package download, Anaconda
> package download, native OS install/extra install
MRAB writes:
> On 27/07/2022 16:43, Cecil Westerhof via Python-list wrote:
>> "Michael F. Stemper" writes:
>>
>>> This is orthogonal to your question, but might be of some use to you:
>>>
>>> The combination of using len(to_try) as an
[email protected] writes:
> On 2022-07-27 at 17:48:47 +0200,
> Regarding "Re: More efficient code, but slower program,"
> Cecil Westerhof via Python-list wrote:
>
>> [email protected] (Stefan Ram) writes:
>>
>> > Cecil W
Roel Schroeven writes:
> Cecil Westerhof via Python-list schreef op 27/07/2022 om 17:43:
>> "Michael F. Stemper" writes:
>>
>> > This is orthogonal to your question, but might be of some use to you:
>> >
>> > The combination of using len(to_
MRAB writes:
>>> When you pop an element from the last, the elements after it need to be
>>> moved down, which takes time.
>>>
>>> Try shuffling the list and then popping the now randomly-ordered
>>> elements off the end.
>> Would shuffling not be a lot more expensive? Especially because I do
>>
Alan Bawden writes:
> Cecil Westerhof writes:
>
>Yes, I try to select a random element, but it has also to be removed,
>because an element should not be used more as once.
>
> Instead of using pop to do that why not something like:
>
> def lazy_shuffle(seq):
> """
> G
On 2022-07-28, Ben Hirsig wrote:
> Hi, I noticed this when using the requests library in the response.elapsed
> object (type timedelta). Tested using the standard datetime library alone
> with the example displayed on
> https://docs.python.org/3/library/datetime.html#examples-of-usage-timedelta
>
On Fri, 5 Aug 2022 08:34:45 +0100, ojomooluwatolami675 wrote:
> Hello, I’m new to learning python and I stumbled upon a question nested
> loops. This is the question below. Can you please how they arrived at 9
> as the answer. Thanks
>
> var = 0 for i in range(3):
> for j in range(-2,-7,-2):
>
Eryk Sun wrote:
If the redirector app
is run without arguments, it will open the Microsoft Store to install
the latest version of the Python store app distribution. Currently
that means Python 3.10.
That is true with cmd. But with a shell like 4NT, I get:
c:\> "%LocalAppData%\Microsoft\Windo
On 2022-08-17, Tobiah wrote:
> I get data from various sources; client emails, spreadsheets, and
> data from web applications. I find that I can do some_string.decode('latin1')
> to get unicode that I can use with xlsxwriter,
> or put in the header of a web page to display
> European characters
On 2022-08-17, Tobiah wrote:
>> That has already been decided, as much as it ever can be. UTF-8 is
>> essentially always the correct encoding to use on output, and almost
>> always the correct encoding to assume on input absent any explicit
>> indication of another encoding. (e.g. the HTML "standa
On 2022-08-17, Barry wrote:
>> On 17 Aug 2022, at 18:30, Jon Ribbens via Python-list
>> wrote:
>> On 2022-08-17, Tobiah wrote:
>>> I get data from various sources; client emails, spreadsheets, and
>>> data from web applications. I find that I can do
>
On 2022-08-18, Tobiah wrote:
>> Generally speaking browser submisisons were/are supposed to be sent
>> using the same encoding as the page, so if you're sending the page
>> as "latin1" then you'll see that a fair amount I should think. If you
>> send it as "utf-8" then you'll get 100% utf-8 back.
On 2022-08-18, Tobiah wrote:
>> You configure the web server to send:
>>
>> Content-Type: text/html; charset=...
>>
>> in the HTTP header when it serves HTML files.
>
> So how does this break down? When a person enters
> Montréal, Quebéc into a form field, what are they
> doing on the keyb
On 2022-08-19, Chris Angelico wrote:
> What's the best way to precisely reconstruct an HTML file after
> parsing it with BeautifulSoup?
>
> Using the Alice example from the BS4 docs:
>
html_doc = """The Dormouse's story
>
>The Dormouse's story
>
>Once upon a time there were three little siste
On 2022-08-20, Chris Angelico wrote:
> On Sun, 21 Aug 2022 at 03:27, Stefan Ram wrote:
>> [email protected] writes:
>> >textual representations. That way, the following two elements are the
>> >same (and similar with a collection of sub-elements in a different order
>> >in anoth
On 2022-08-20, Stefan Ram wrote:
> Jon Ribbens writes:
>>... or you could avoid all that faff and just do re.sub()?
>
> import bs4
> import re
>
> source = ''
>
> # Use Python to change the source, keeping the order of attributes.
>
> result = re.sub( r'href\s*=\s*"http"', r'href="https"', source
On 2022-08-21, Chris Angelico wrote:
> On Sun, 21 Aug 2022 at 09:31, Jon Ribbens via Python-list
> wrote:
>> On 2022-08-20, Chris Angelico wrote:
>> > On Sun, 21 Aug 2022 at 03:27, Stefan Ram wrote:
>> >> [email protected] writes:
>> >
On 2022-08-21, Peter J. Holzer wrote:
> On 2022-08-20 21:51:41 -, Jon Ribbens via Python-list wrote:
>> On 2022-08-20, Stefan Ram wrote:
>> > Jon Ribbens writes:
>> >>... or you could avoid all that faff and just do re.sub()?
>
>> > source =
On 2022-08-21, Chris Angelico wrote:
> On Mon, 22 Aug 2022 at 05:43, Jon Ribbens via Python-list
> wrote:
>> On 2022-08-21, Chris Angelico wrote:
>> > On Sun, 21 Aug 2022 at 09:31, Jon Ribbens via Python-list
>> > wrote:
>> >> On 2022-08-20, Chris Angel
On 2022-08-22, Peter J. Holzer wrote:
> On 2022-08-22 00:45:56 -, Jon Ribbens via Python-list wrote:
>> With the offset though, BeautifulSoup made an arbitrary decision to
>> use ISO-8859-1 encoding and so when you chopped the bytestring at
>> that offset it only worked
What Changed?
=
This is an enhancement and bug-fix release, and all users are encouraged to
upgrade.
Brief summary:
* Fixed #181: Added the ability to pass file paths to encrypt_file,
decrypt_file,
sign_file, verify_file, get_recipients_file and added import_keys_file.
* Fixed #18
On 9/5/22 21:22, Meredith Montgomery wrote:
I never read a book on Python. I'm looking for a good one now. I just
searched the web for names such as Charles Petzold, but it looks like he
never wrote a book on Python. I also searched for Peter Seibel, but he
also never did. I also tried to sea
unsubscribe
-Bat
> On Sep 12, 2022, at 14:32, [email protected] wrote:
>
> Suddenly I can no longer add blogs to Django. Django says 'blog
> matching query does not exist'. That seems strange to me because I want
> to add something to the database and not request a blog. What could b
On 2022-09-26, Stefan Ram wrote:
> So, I wanted to try to download all pages in parallel with
> processes to avoid any GIL effect, while I don't understand
> what the GIL actuall is. But processes didn't work here, so
> I tried threads. This worked and now the total run time is
> down to
Hi all,
in a (Flask) web application I often find that many equal (SQLAlchemy) queries
are executed across subsequent requests. So I tried to cache the results of
those queries on the module level like this:
@lru_cache()
def query_db(db, args):
# do the "expensive" query
r
Recently I completed a project where I used PyObject_CallFunctionObjArgs
extensively with the NLTK library from a program written in NASM, with no
problems. Now I am on a new project where I call the Python random library. I
use the same setup as before, but I am getting a segfault with random
Hi Chris and dh,
thanks for your --as usually-- thoughtful and interesting answers. Indeed, when
doing these web applications I find that there are several layers of useful,
maybe less useful, and unknown caching. Many of my requests rely on a
notoriously unreliable read-only database outside of m
cremented the reference to all objects in Get_LibModules, but I still
get the same segfault at PyObject_CallFunctionObjArgs. Unfortunately,
reference counting is not well documented so I’m not clear what’s wrong.
Sep 29, 2022, 10:06 by [email protected]:
> On 2022-09-29 16:5
>
> So I incremented the reference to all objects in Get_LibModules, but I still
> get the same segfault at PyObject_CallFunctionObjArgs. Unfortunately,
> reference counting is not well documented so I’m not clear what’s wrong.
>
>
>
>
> Sep 29, 2022, 10:06 by p
;> value_ptr, NULL);
>>
>> if (p_seed_calc == 0x0){
>> PyErr_Print();
>> return 1;}
>>
>> //Prepare return values
>> long return_val = PyLong_AsLong(p_seed_calc);
>>
>> return return_val;
>> }
>>
>> So I in
Thanks very much for your detailed reply. I have a few followup questions.
You said, “Some functions return an object that has already been incref'ed
("new reference"). This occurs when it has either created a new object (the
refcount will be 1) or has returned a pointer to an existing objec
That's great. It clarifies things a lot for me, particularly re ref count for
new references. I would have had trouble if I didn't decref it twice.
Thanks very much once again.
Sep 30, 2022, 12:18 by [email protected]:
> On 2022-09-30 17:02, Jen Kris wrote:
>
>>
>> Thanks very
1601 - 1700 of 5863 matches
Mail list logo