On Sun, 13 Mar 2022 at 10:41, Jen Kris wrote:
>
>
> Thanks for PySequence_InPlaceConcat, so when I need to extend I'll know what
> to use. But my previous email was based on incorrect information from
> several SO posts that claimed only the extend method will work to add tuples
> to a list.
Thanks for PySequence_InPlaceConcat, so when I need to extend I'll know what to
use. But my previous email was based on incorrect information from several SO
posts that claimed only the extend method will work to add tuples to a list. I
found that's wrong -- even my own Python code uses the a
On Sun, 13 Mar 2022 at 10:30, Jen Kris wrote:
>
>
> Chris, you were right to focus on the list pDictData itself. As I said,
> that is a list of 2-tuples, but I added each of the 2-tuples with
> PyList_Append, but you can only append a tuple to a list with the extend
> method. However, there
Chris, you were right to focus on the list pDictData itself. As I said, that
is a list of 2-tuples, but I added each of the 2-tuples with PyList_Append, but
you can only append a tuple to a list with the extend method. However, there
is no append method in the C API as far as I can tell -- h
On Sun, 13 Mar 2022 at 08:54, Jen Kris wrote:
>
>
> pDictData, despite the name, is a list of 2-tuples where each 2-tuple is a
> dictionary object and a string.
>
Ah, gotcha. In that case, yeah, slicing it will involve referencing
the tuples all the way down the line (adding to their refcounts,
pDictData, despite the name, is a list of 2-tuples where each 2-tuple is a
dictionary object and a string.
Mar 12, 2022, 13:41 by ros...@gmail.com:
> On Sun, 13 Mar 2022 at 08:25, Jen Kris via Python-list
> wrote:
>
>> PyObject* slice = PySlice_New(PyLong_FromLong(0), half_slice, 0);
>> PyOb
Thanks to you both. I am going to implement PySequence_Get_Slice now. If I
have trouble then, per comments from Chris Angelico, I will iterate through
pDictData to verify it because I haven't done that. It is not null, however.
Jen
Mar 12, 2022, 13:40 by pyt...@mrabarnett.plus.com:
> O
On Sun, 13 Mar 2022 at 08:25, Jen Kris via Python-list
wrote:
> PyObject* slice = PySlice_New(PyLong_FromLong(0), half_slice, 0);
> PyObject* subdata_a = PyObject_GetItem(pDictddata, slice);
>
> On the final line (subdata_a) I get a segfault. I know that the second
> parameter of PyObject_GetIt
On 2022-03-12 21:24, Jen Kris via Python-list wrote:
I have a C API project where I have to slice a list into two parts.
Unfortunately the documentation on the slice objects is not clear enough for me
to understand how to do this, and I haven’t found enough useful info through
research. The
On 2022-03-12 at 21:45:56 +0100,
Marco Sulla wrote:
[ ... ]
> So if I do not cache if the object is unhashable, I save a little
> memory per object (1 int) and I get a better error message every time.
> On the other hand, if I leave the things as they are, testing the
> unhashability of the obj
I have a C API project where I have to slice a list into two parts.
Unfortunately the documentation on the slice objects is not clear enough for me
to understand how to do this, and I haven’t found enough useful info through
research. The list contains tuple records where each tuple consists
I have a custom immutable object, and I added a cache for its hash
value. The problem is the object can be composed of mutable or
immutable objects, so the hash can raise TypeError.
In this case I currently cache the value -1. The subsequent calls to
__hash__() will check if the value is -1. If so
Nicolas Haller wrote at 2022-3-12 12:05 -0500:
>On 2022-03-10 12:31, Dieter Maurer wrote:
>> Nicolas Haller wrote at 2022-3-9 10:53 -0500:
>>> ...
>>> The documentation about "user-defined generic types"[1] says that I can
>>> fix some types on a child class (class MyDict(Mapping[str, T]):) but
>>>
On 2022-03-10 12:31, Dieter Maurer wrote:
Nicolas Haller wrote at 2022-3-9 10:53 -0500:
...
The documentation about "user-defined generic types"[1] says that I can
fix some types on a child class (class MyDict(Mapping[str, T]):) but
doesn't say much about the signature of the methods I need to
i
14 matches
Mail list logo