Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
15 views

Modify the values in a (global) list of dictionary without reference

I'm new to python - being an educator trying to write to python script to score student's performance downloaded from an online polling platform. I've solved most problems until something like this: I'...
Chris H's user avatar
0 votes
1 answer
102 views

C# double.Parse TextBox from List in another Class is always '0' or 'NaN'

Let's start with the intended workflow: A List of textboxes is created in Class1 and added into a Panel. The List is called in Class2 to use double.Parse with the user inputs in Windows Forms. A ...
NICOLAS LEON NARINO's user avatar
0 votes
1 answer
39 views

How does the value of an untouched integer change here? [duplicate]

This really, really messed with me today. This is the most minimum working example I could get: array = [ 1, 2, 1, 3, 4 ] n = 3 ...
user129393192's user avatar
0 votes
1 answer
104 views

How to count references in java correctly?

I have difficulties understanding how to correctly count a reference variables. Example (adopted from some book for java learning): class Car { } class Example { public static void main(String[] ...
ImNotARobot's user avatar
1 vote
2 answers
87 views

Confusion when defining a list of array refs as constant

In some Perl code I'm doing some low-level coding accessing Perl constants that are lists, like this: use constant LIST => () As Perl constants are actually implemented as functions, I'm trying ...
U. Windl's user avatar
  • 4,069
0 votes
2 answers
54 views

I'm curious about python list's initialization and reference

Let me make a list and change one element like this: list = [float("inf")] * 3 list[2] = 0 then I print it, It prints print(list) > [inf, inf, 0] I thought each element references the ...
Shin's user avatar
  • 21
0 votes
1 answer
37 views

Python lists always assign reference not value

I want to copy list values to another list because I modify the original one and use the new one. Bu t whatever I try it will alwasy assign reference not value. class Chromosome: def __init__(...
Hakan SONMEZ's user avatar
  • 2,206
0 votes
0 answers
23 views

Reassigning variables in Python: garbage collector vs manual erase efficiency [duplicate]

What is the best practice when reassigning object variables, to maximise memory and CPU efficiency? We all know object variables do not actually "contain" the object data, but they're just ...
user3311717's user avatar
0 votes
2 answers
37 views

Why are the results different depending on how to assign?

When I tried to reverse the Linked list, I noticed that the results varied depending on how I did the assignments. Why does it happen as bellow? class ListNode: def __init__(self, val=0, next: ...
kama-meshi's user avatar
0 votes
1 answer
52 views

Why two reference of the same list behave like if they are two deep copy even if not?

In my architecture, i have business object (BO from now on), that return a standard result of type OperationResult<some_generic_type> so that each BO result is provided with instrumented ...
Skary's user avatar
  • 1,352
-3 votes
1 answer
47 views

Why doesn't list change?

In Python: b = [] a = np.arange(2) b.append(a) a = np.arange(4) b.append(a) print(b) # gives [array([0, 1]), array([0, 1, 2, 3])] Why doesn't it give [array([0, 1, 2, 3]), ...
Physics Enthusiast's user avatar
1 vote
0 answers
52 views

How to copy a list with reference so the changes to the copied version also apply to the original one in C++?

In my homework I have to make the FooCl class for these: int main() { int x[] = {2, 3, 7, 9, 21, 11, 54, 91}; FooCl<int> itemsI(x, sizeof(x) / sizeof(x[0])); std::string s[] = {&...
Dodande's user avatar
  • 99
0 votes
1 answer
61 views

Why am I getting a copy instead of a reference when flattening a list of ndarrays?

And how do I get references to each element in the ndarrays? The goal is to take a list of variable shaped ndarrays containing primitives, use ravel() on all the ndarrays and merge them into a list ...
John Glen's user avatar
  • 882
0 votes
3 answers
540 views

Retrieving values from an ArrayList of IntArrays

So I know I'm missing something obvious, however, after searching similar/related questions, I can't quite figure out what I'm doing wrong. New to Kotlin, so probably something I'm not understanding ...
Ditto's user avatar
  • 3,316
0 votes
2 answers
80 views

I'm trying to understand how reference works in python

After line 7, I haven't written a single line of code which mentions the list named 'outer'. However, if you execute it, you'll see that the 'outer' (i.e, the nested lists inside it) list would change/...
Sai Surisetti's user avatar

15 30 50 per page
1
2 3 4 5
20