Questions tagged [variable-names]

256 questions
0
votes
1 answer

Change the values of an object's properties, depending on the property's name

I would like to change the value of targeted properties within my object depending on the property's name. Example: // Returns a list of all the properties of an object PropertyInfo[] properties = GetProperties(myObject); // Set the values of all…
0
votes
0 answers

How to identify the varname from an OLS fit summary?

This is a model for MLB, and to my understanding each var name (x1,x2,x3...) should be associated with a pitcher name. How can I identify which pitcher is associated with the var name? OLS Regression Results …
0
votes
1 answer

How to extract the name of a variable in a Python function

I have a custom Python function that uses the input of a model to create a data frame of the predicted y-values, probabilities, and some other features. I am trying to extract the physical variable name and use it as column within the data frame. In…
mf17
  • 91
  • 6
0
votes
1 answer

Dynamic variables' construction possible with vb.net

Could I create dynamically variable names for already declared variables using vb.net. A little, but not quite, the way I would do the 'echo' of PHP? For example if I had a code looking like that: Module Module1 Public Class my_Class …
NorKayak
  • 41
  • 7
0
votes
0 answers

How to convert variable name into string when the variables are stored in a list

So there is a similar question on How to convert variable (object) name into String using deparse(substitute(variable)) but the solution doesn't work when variables are stored in a list. Example : # I want to convert mtcars into a string…
0
votes
1 answer

why some source code use var{Number} form variable name

when I view java source code referenced from Intellij IDEA,I find some variables named like var+Number. For example, below code is from org.springframework.context public interface MessageSource { @Nullable String getMessage(String var1,…
Zack
  • 1
  • 1
0
votes
1 answer

How to use variable names of jdbc preprocessor in jsr223 preprocessor?

set variable names on jdbc preprocessor. variable names : aa,bb excute query select aa, bb from table; try to get the variable names on jsr223 preprocessor log.info(vars.get("aa")); but this via aa is null how to use variable…
0
votes
2 answers

Python: NameError when trying to print a previously defined variable in an else statement of handling error delcaration

I have the following simple code that aims to redefine the variable y when it is mathematically impossible for it to be the divisor of x: x = 5 y = 0 while True: try: z = x/y except: while True: try: …
Mauro
  • 477
  • 1
  • 9
  • 22
0
votes
3 answers

Should I avoid using "str" as a variable name in Python?

I've noticed that certain variable names in Python get flagged up by Vim in blue highlight, whereas others do not. I'm familiar with the concept of reserved words, per this question, but from looking it up, "str" does not appear to be one of these…
Lou
  • 2,200
  • 2
  • 33
  • 66
0
votes
3 answers

Increment variable name results in command not found

I am trying to increment a variable name based on the input and call the value after the loop is done. for i in `seq 5`; do var$i="number is $i" done echo $var2 $var5 Results in ./test.sh: line 4: var1=number is 1: command not found ./test.sh:…
xavi
  • 109
  • 6
0
votes
4 answers

Set string to variable name

There is a very long select-box in my html document. Every option has got an own name. I want to convert the value-string of the selected option into a javascript-variable. Or do I have to do it with a switch-case-query? Example: var…
Google
  • 3
  • 2
0
votes
1 answer

How to get string name of defined variable in python?

We know that in python you can get the name of a defined function: eg. def f(x): return x print(f"we've just defined function {f.__name__}") Let's say i create a variable: x = 4 Now at some point i would like to do: print(f"you have defined a…
moctarjallo
  • 1,479
  • 1
  • 16
  • 33
0
votes
1 answer

Dynamic variable name with dashes in thymeleaf

I am trying to create a variable name in thymeleaf by using another variable as prefix: th:with="appOverview = ${__${tabId}__AppOverview}" It works most of the times, but in the case where tabId contains dashes (i.e., "my-test-tab"), thymeleaf…
Yiorgos
  • 111
  • 8
0
votes
1 answer

How to avoid cluttering the names of Python functions that differ in their input argument types?

Suppose you have functions f1: A1 ->B, f2: A2->B, …. Julia has function overloading, so you could define them all as f, and the type A1, A2, … will determine which one gets applied. When encountering this situation in Python, is there any way to…
ashman
  • 154
  • 1
  • 5
0
votes
1 answer

How to find a reference to an array by the name of the variable as defined in the code in C#?

Obviously, I'm not looking for the classic: string[] garden = {"Tulip"}; Console.WriteLine(garden[0]); but rather, doing the same with a string: string[] garden = {"Tulip"}; string gardenname = "garden"; string[] cool_NEW_array =…
Werty980
  • 19
  • 7