1,506 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
0
answers
82
views
Copy a generator via ctypes
I'm trying to copy a generator by using PyGen_New by passing in a frame object. Thus far, I get the following error that I don't understand:
Traceback (most recent call last):
File "C:\test.py&...
0
votes
1
answer
68
views
Python function deepcopy does not copy gym environment LunarLanderContinuous-v2 correctly
As the code and its output shows the deepcopy of this environment does not copy aspects of the environment such as the 'action_space' and the attribute 'continuous'.
How can this be resolved?
...
-3
votes
1
answer
133
views
Make a deep copy of an object in C# with private readonly variables and objects
This is a follow up question to my previous one, Make a deep copy of an object inside a ConcurrentDictionary in C#. I want to clone my Patient object so that the object PatientCovariates is the same ...
-3
votes
1
answer
97
views
Make a deep copy of an object inside a ConcurrentDictionary in C#
This is a follow up question to my previous one, Deep copy a ConcurrentDictionary in C#, which did not contain sufficient information for it to be properly answered.
I am trying to make a deep copy of ...
-1
votes
1
answer
122
views
Deep copy a ConcurrentDictionary in C# [closed]
I am trying to make a deep copy of a ConcurrentDictionary in C#, but failing. How can I do so that cdTwo becomes a deep copy of cdOne so that I can change the DataObj in cdTwo without chaning it in ...
4
votes
1
answer
142
views
In Eigen, for a preallocated matrix, does the assignment operator try to reuse existing memory?
Consider the following Eigen code snippets:
Option 1
Eigen::MatrixXf A (m, n), B;
B = A;
Option 2
Eigen::MatrixXf A (m, n), B (m, n);
B = A;
In option 1, I assume B starts off having size (0, 0), and ...
-2
votes
2
answers
72
views
Strange behavior when deep cloning dynamic objects
I have been trying to deep clone a dynamic object in typescript and all methods just return an empty {} object for this specific scenario!!
Here is the type of object I am trying to deep clone
...
1
vote
2
answers
71
views
Unexpected modification of the c language linked list
#include <stdio.h>
#include <stdlib.h>
// 定义DocNode结构
struct DocNode {
int doc_id;
struct DocNode* next;
};
// 创建新的节点
struct DocNode* create_node(int doc_id) {
struct DocNode*...
1
vote
1
answer
113
views
Why is deepcopy() very fast with pandas.Dataframe?
deepcopy() is well known for being very slow (even with no nested object in it).
For example
a = list(range(10**7))
b = a.copy() #takes 0.04 secs
c = deepcopy(a) # takes 2.3 secs
Then why do I ...
0
votes
1
answer
193
views
How do the copy and deepcopy functions work for a bytearray argument?
The docs say:
The difference between shallow and deep copying is only relevant for compound objects (objects that contain other objects, like lists or class instances)
It seems that the bytearray ...
-1
votes
2
answers
192
views
What is a faster way to deep copy a nested list without using .deepcopy()?
I have two variables with the following structures:
# initialization
O1 = [[] for g in range(n)]
for i in range(n):
O1[i] = [[] for g in range(m)]
O2 = [[] for g in ...
0
votes
0
answers
72
views
Deep Cloning of a TabPage
I have a TabPage with several panels and nested controls inside them like comboboxes, maskedtextboxes, textboxes, buttons, datagridviews etc.
My goal is to clone this TabPage with all of it's controls ...
0
votes
2
answers
81
views
Why changing inner element changes the element of copied list, but changing the whole element does not [duplicate]
I know about deep copy in Python, but I need exact explanation of what happens after changing the first element of a, or maybe the explanation of happens here.
>>> a=[[0,1],[2,3]]
>>>...
1
vote
2
answers
190
views
How to pass an object to a constructor where the former becomes part of the instance's data and its getters can reach class specific props and methods
Is it possible to "import" or "pass" a pre-defined object into a class that has access to methods on that class? Importantly, for performance reasons, I need to ensure that I am ...
2
votes
2
answers
147
views
Is Python function immutable?
I have
import copy
class A:
_member_a: dict[str, str]
_member_b: Callable
def set_b(self, func):
self._member_b = func
def deep_copy(self):
return copy.deepcopy(self)
I ...