Questions tagged [arguments]
An argument is a value passed to a function, procedure, or command line program. This also refers to the Array-like `arguments` object in JavaScript.
11,350
questions
-1
votes
1
answer
37
views
What is "=- 1" in a python method's argument list?
On the following page: subprocess.popen, in the argument list of popen() there is a "pipesize=- 1". Since it pops up at a few places, it does not seem to be a typo.
As for what this may be, ...
0
votes
0
answers
7
views
How can I reference the class in one of it's methods as a type hint? [duplicate]
Im trying to create an equals method for my class Field.
However, when I'm trying to give Field as a type hint in the arguments, I'm getting Field is not defined.
#!/usr/bin/env python
# -*- coding: ...
1
vote
1
answer
31
views
Preference in parameters order for argc, argv [closed]
Trivial question.
I have functions which manipulate the command line string, and I found easier to pass argc and argv to them, so that I delegate the treatment and I don't invent extra things before ...
0
votes
1
answer
43
views
Function arguments alignment in C
The array in procedure breaking procedure arguments alignment.
Having a following code:
void _func(unsigned long cnt, int* adr, ...){
char a[1];
printf("cnt: %p, adr: %p\n", &cnt,...
3
votes
1
answer
33
views
How to pass in multiple arguments to an APL function
I'm trying to write a few different functions, such as standard deviation and linear regression in APL. I need to pass in a list of (x, y) points, but I can't figure out how to do that because I know ...
0
votes
1
answer
30
views
safe args navigation not work in android kotlin
I'am trying to use Safe Args plugin to generate fragment direction that will used to navigate to another fragment with action,i include the dependency but it still not work
gradle project:
buildscript ...
1
vote
2
answers
23
views
Takes 0 positional arguments but 2 were given, when it is not the case
SOLVED, answer below!
Here is the relevant fragment of the code:
def redraw() -> int:
subprocess.call(['tput', 'reset'])
cursor.hide()
print(get_time())
return 0
def main() -> ...
0
votes
2
answers
34
views
I'm trying to exclude elements from an Array, but I'm doing somthing wrong
I'm trying to create this script: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy
After the comment "Verify and ...
1
vote
2
answers
53
views
pass an address to a function in vba function
see the basic function structure
function test (first as range)
whatever I do inside
end function
calling the function and first is the address of the first cell, for example, B2, like this:
first=...
-2
votes
1
answer
33
views
Using args with strings [closed]
The task is to create a function in python which takes a string and returns that string with the even positioned letters upper case and the odd positioned letters lowercase.
Here is my attempt.
def ...
-3
votes
0
answers
14
views
Python can't decide on number of arguments a function takes [closed]
I have a really annoying problem and im helpless.
Basically, I have a function which takes 2 arguments, and I call it with 2 arguments once and everything works, but when I call it a second time (with ...
0
votes
2
answers
22
views
random number generating function as argument in python
I want to pass a function which generates random normal numbers to another function, do some calculations and pass again the random function x times. At the end there should be a Dataframe with x ...
-1
votes
1
answer
23
views
Optional function arguments in Python [duplicate]
I have a function with two parameters:
def myFunc(arg1, arg2):
#do stuff
if arg1 == "abc": #Extremely rare situation
# do sth with arg2
Most of the function calls were myFunc(param), ...
0
votes
1
answer
35
views
getopts & preventing accidentally interpreting short options as arguments
Here's a toy example that shows what I mean:
while getopts "sf:e:" opt; foundOpts="${foundOpts}${opt}" ; done
echo $foundOpts
problem is that getopts isn't particularly smart when ...
0
votes
0
answers
30
views
How to accept undefined amount of different types of variables as parameters in C++ [duplicate]
I'm trying to write an API where I have to be able to accept an undefined amount of variables into a function. I tried it with a template but it doesn't work and I wasn't able to find out the issue. ...
0
votes
2
answers
42
views
can I pass java vm args i.e. -xms and -xms through a property file to my java program
Can anybody help me in following problem:
if I am specifying java args while running my program through java command then if I check my java process using ps -ef command it shows me a long output ...
0
votes
1
answer
28
views
How to call a php file with arguments from VBA for Mac? Equivalent of VBA.createObject("wscript.shell") on Mac?
Still in need of help :)
I'm trying to adapt the following chunk of code to VBA for Mac (as the final implementation has to be on Mac):
Dim ws as Object
Dim result as String
Set ws = VBA.CreateObject(&...
0
votes
0
answers
11
views
"Platon's Crito and Philosophy"
"In Platon's Crito 50a-b", how do you reconstruct Sokrates' words as a "philosophical question" (with "premises" and "conclusion")?
0
votes
1
answer
20
views
Type Error: argument of type 'Word2Vec' is not iterable
doc2vecs = Doc2VecTrainer(Xs, embd_size, w, min_word_count, worker_threads)
File "C:\Users\PC 5\Desktop\embedding.py", line 63, in Doc2VecTrainer
if Samples[i][j] in word2vec_model:
...
0
votes
1
answer
27
views
Scipy minimization one variable while keeping some variables constant - args defining problem
I have a function where I need to minimize c_init to make totalF output zero. the problem is that I have some constants over this function which are Es, f_slong and f_c. I need to repeat this whole ...
0
votes
1
answer
18
views
special characters like asterisks argv
Running my script like the following:
Node index.js POST *
In my script I do this:
process.argv.forEach((val, index) => {
console.log(`${index}: ${val}`);
});
The output will be the following ...
-1
votes
0
answers
12
views
IllegalArgumentException in SQL. Don't see the Issue
I'm dealing with basic SQL commands. All the columns seem to have correct data types, so I already ruled that out. Nonetheless, kindly look for errors in the screenshots I attached. The result I ...
0
votes
1
answer
32
views
A function which join a various amount of string columns using args
The goal is to create a function which can join and *args amount of columns with string values. This could be done vectorized or by for loops.
I have attempted the following code:
class Manipulation(...
-1
votes
0
answers
21
views
Is there a Pythonic way of dealing with mutable default arguments *and* allowing `None`? [duplicate]
So I know that "mutable default arguments" are a 'feature' of Python that can often cause unexpected behaviour (there's an interesting Stack Overflow page about here: "Least ...
0
votes
1
answer
30
views
Javascript: How to populate arguments passed to a function?
I have this code that returns cartesian product of three arrays:
function getcartesianProduct(symbols: Array<string>) {
const cartesian = <T,>(...sets: T[][]) => sets.reduce<T[][]&...
0
votes
1
answer
56
views
how to add safeargs to project level Kotlin gradle
Another user asked the same question, but I could not understand the solution. I also don't understand why the Android Developer page doesn't show a path according to this new version.
buildscript {
...
0
votes
0
answers
46
views
Python: Tell if the argument passed to a function is a constant or is a variable
I want to create a function that would behave differently depending on how the input is passed to it.
For example:
def my_func(a):
if is_constant_input(a): # Does something like this conditional ...
0
votes
0
answers
20
views
VBA Passing variable to a PageSetUp Function
I have a couple of different sheets I need to print and the PageSetup properties are pretty much the same except for a RightFooter or LeftHeader that changes based on each sheet.
I'm trying to built a ...
0
votes
0
answers
13
views
How can I take a list that isn't a set length, and use each item as an argument for a function? [duplicate]
I'm trying to find a way to take a list of integers and put each one as an argument of a function without knowing the length of the list. I have been trying to do things like join and such but that ...
0
votes
0
answers
13
views
Python - Validation of input arguments
I would like to validate the input argument against the supported/accepted value. Let's say pt is an input argument and user can insert the value as a single text ("apple") or multiple one ( ...
0
votes
1
answer
20
views
start script with arguments sys.argv
Im trying to start this script with a argument.
When i start the script from a terminal i want to type "python test.py C:\Users\etc\etc\log.log count" to run func1 or error to run func3.
I ...
0
votes
1
answer
16
views
Arguments Object is Empty Despite Setting Default Argument Value – is there a Workaround?
Given this function (e.g. in node.js)
> function f (a = 1) { return arguments; }
undefined
> f(1)
[Arguments] { '0': 1 } // arguments object contains value for argument a
> f() ...
0
votes
0
answers
24
views
Display of different pins custom on map SwiftUi (error extra argument)
I'm trying to display custom pins on my map, only an error appears "extra arguments at postions #7, #8 in call. If anyone can help me I would be grateful!
(I'm new to swift)
var body: some View {
...
2
votes
3
answers
44
views
Processing arguments for subprocesses using argparse: "Expected one argument"
First of all, I am sorry about the title that does not give a perfect idea of what my problem is, I kinda struggled with it, so I am going to illustrate it more clearly with a reproducible example:
I ...
1
vote
1
answer
47
views
How to pass arguments to program when using variable as path
I'm trying to start a program in a Start-job scriptblock using a variable for the path. Here is the line:
$using:plinkdir\plink.exe -telnet $using:ip -P $using:port | TimeStamp >> "$using:...
0
votes
1
answer
43
views
Is the a way to print all the arguments of av without using ac in the body of the function
#include<stdio.h>
/**
* main - prints all arguments without using ac
* @ac: number of arguments in av
* @av: array of strings (arguments)
*/
int main(int ac, char **av)
{
int i;
for(...
1
vote
2
answers
33
views
Issue for pass 'double' arguments to widget in others pages with RouteSettings
I have a problem with my app...
I want only pass two 'double' arguments to widget in others pages when user using ElevatedButton and recover arguments for set coordonate in Maps.
I tried all the ways ...
0
votes
1
answer
38
views
How do I add a CLI argument to find files >, <, or = a given size?
I am basically trying to have three arguments for CLI user input:
Folder path
<, >, or =
File size
With these arguments, I want my application to fetch information for all files in the folder ...
0
votes
1
answer
7
views
How to export data in R to a directory that you have created with arguments from the command line?
I am trying to save data (e.g. a png image) into a folder that I create from the arguments of the command line.
This is my script.
#myscript.R
#!/usr/bin/Rscript --vanilla
args<-commandArgs(TRUE)
...
0
votes
0
answers
59
views
TypeError: Invalid type for argument in function call. Invalid implicit conversion from string memory[3] memory to string memory[] memory requested
I am trying to pass an array to a smart contract function but getting following error.
contract ElectionList {
constructor() public{
createElection("CHRIST COLLEGE ELECTION", ["amal&...
0
votes
1
answer
22
views
Why am i getting a missing 1 required positional argument: 'connectionList' error but can print connectionList?
could you please explain why connectionList doesn't seems to get passed to the connectionMaker method ?
Output of the print :
[('tFrictionpushButton', 'None', 'clicked', 'open_tFriction'),
('...
0
votes
0
answers
18
views
Referencing a function argument from a seperate object?
I'm currently working on a Rock-paper-scissors project, but ran into a bit of a problem regarding lexical scopping (at least, I believe that's the issue).
The game works by having the user click on ...
0
votes
0
answers
43
views
Prevent PHP leaking variables with include or require
I have unwanted arguments leaking into my template.php.
function template($template, $args) {
$foo = $args['bar'];
extract($args);
include __DIR__ . '/' . $template . '.php';
}
In the ...
0
votes
1
answer
33
views
Functions arguments vs use keyword argument in anonymous function?
Often we come across one point where we are using some closures in PHP and as I use Laravel for my projects closures are used so much in frameworks
like in eloquent queries
So here is a scenario
$name ...
0
votes
1
answer
20
views
Warning in max(max_DOUBLE_ZERO_BID_PRICE, na.rm = T): no non-missing arguments ## to max; returning -Inf ERROR in R
When running code below I got lots of messages like:
> ## Warning in max(max_DOUBLE_ZERO_BID_PRICE, na.rm = T): no non-missing arguments
> ## to max; returning -Inf
sp500_options[order(...
0
votes
1
answer
42
views
How do I pass args and kwargs to a REST endpoint built with FastAPI?
I am building a REST api using FastAPI. The goal is to run a python function over the network and return the result.
Note that I CAN modify the client & the server code.
At a high level the code ...
-1
votes
0
answers
12
views
Basic design question having two different implementation of an interface whics falls under same domain
Could be silly question but needed thoughts.
Need to design two different implementation of an interface which both updates a configuration in application but the config getting updated are different.
...
0
votes
1
answer
54
views
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'Future' in Jupyter Notebook online
When I try to run the following code in Jupyter notebook online:
age=int(input('enter your age'))
print(age)
I get TypeError:
TypeError Traceback (most recent ...
0
votes
3
answers
40
views
How to code "Find Numbers Divisible by Another Number" using lists inside funciton?
I am unable to run the above code, can you pls help me with the code and where I am going wrong:
list1 = []
for i in range(1,no):
list1.append(ele)
for i in list1:
...
0
votes
0
answers
18
views
Can I construct a variable's name from strings in Python? [duplicate]
I was wondering if I can pass an argument to a function by passing it a different argument that constructs the first argument's name from strings. Basically cut(arg) to be the same as cut(clip_a)?
str ...