arguments Questions

1

In order to indicate that an argument is a list one can use: def fun(words:list): code... How can I indicate that an argument should be a list of lists? All I can think about is doing something l...
Bridesmaid asked 21/9, 2021 at 9:51

1

Solved

I am having trouble figuring out why is npm taking . without -- delimiter. In the following command . is passed to test script without -- delimiter. npm test . test script is defined in package.js...
Intendment asked 7/9, 2021 at 12:9

4

Solved

In C, getopt_long does not parse the optional arguments to command line parameters parameters. When I run the program, the optional argument is not recognized like the example run below. $ ./resp...
Argybargy asked 27/6, 2009 at 12:15

3

I am trying to find a way to pass my function's default arguments to the decorator. I have to say I am fairly new to the decorator business, so maybe I just don't understand it properly, but I have...
Isador asked 30/7, 2015 at 15:44

2

Solved

I am trying to make a build script like this: import glob import os import subprocess import re import argparse import shutil def create_parser(): parser = argparse.ArgumentParser(description='B...
Spiculate asked 2/4, 2020 at 19:42

20

Solved

I need to pass an ID and a password to a batch file at the time of running rather than hardcoding them into the file. Here's what the command line looks like: test.cmd admin P@55w0rd > test-lo...
Morel asked 25/8, 2008 at 18:14

2

Here's some pseudo code showing what I'm trying to achieve: Text txt(text, [subtitle = false]) { final params = subtitle ? { 'textAlign': TextAlign.center, 'style': TextStyle(color: Colors.purp...
Buttonhook asked 19/1, 2021 at 17:35

5

Solved

I want to convert the arguments to a function into an associative array with keys equal to the parameter variable names, and values equal to the parameter values. PHP: function my_function($a, $...
Cysteine asked 14/9, 2009 at 2:38

14

Solved

I have now seen 2 methods for determining if an argument has been passed to a JavaScript function. I'm wondering if one method is better than the other or if one is just bad to use? function Test...
Exultant asked 4/1, 2009 at 17:38

15

Solved

I have a function that takes optional arguments as name/value pairs. function example(varargin) % Lots of set up stuff vargs = varargin; nargs = length(vargs); names = vargs(1:2:nargs); values = v...
Gadolinium asked 5/5, 2010 at 17:3

28

Solved

$1 is the first argument. $@ is all of them. How can I find the last argument passed to a shell script?
Scalar asked 5/12, 2009 at 23:58

8

Solved

I was wondering about the best practices for indicating invalid argument combinations in Python. I've come across a few situations where you have a function like so: def import_to_orm(name, ...
Sapp asked 1/11, 2008 at 23:2

6

Solved

Is there a way to match any class argument of the below sample routine? class A { public B method(Class<? extends A> a) {} } How can I always return a new B() regardless of which class is...
Ihram asked 21/9, 2011 at 13:9

2

Solved

Why doesn't arguments stringify to an array ? Is there a less verbose way to make arguments stringify like an array? function wtf(){ console.log(JSON.stringify(arguments)); // the ugly workaro...
Dynamometry asked 9/7, 2013 at 11:22

29

Solved

I would like a JavaScript function to have optional arguments which I set a default on, which get used if the value isn't defined (and ignored if the value is passed). In Ruby you can do it like th...

2

Solved

I am trying to pass a Dict to a function in Julia. The Dict contains pairs of argument names and their respective values. Let's say I have a function f and a Dict d: julia> function f(x=10, y=1...
Mocambique asked 17/11, 2019 at 15:4

7

Solved

It's probably a lame question. But I am getting 3 arguments from command line [ bash script ]. Then I am trying to use these in a for loop. for i in {$1..$2} do action1 done This doesn't seem to ...
Borowski asked 17/4, 2011 at 2:45

5

Solved

I have this code for the C# in Visual Studio 2012. public Task SwitchLaserAsync(bool on) { return Task.Run(new Action(() => SwitchLaser(on))); } This will execute SwitchLaser method (public ...
Bharal asked 25/10, 2012 at 15:15

2

I have a function whose argument is a list of dictionaries. I am trying to specify the type of elements for the dictionary in the function argument. The dictionary has the following form: {'my_obje...
Rahn asked 20/7, 2020 at 3:47

2

Solved

On a stack trace returned from a PHP application in development, long string arguments to a function are truncated when display on the error page: Abstract.php(238): Zend_Db_Adapter_Abstract->q...
Eustoliaeutectic asked 22/12, 2010 at 18:17

4

I've got python script (ala #! /usr/bin/python) and I want to debug it with pdb. How can I pass arguments to the script? I have a python script and would like to debug it with pdb. Is there a way ...
Alyose asked 16/5, 2009 at 19:17

3

Solved

Problem I am trying to use scikit-learn's LogisticRegressionCV with roc_auc_score as the scoring metric. from sklearn.linear_model import LogisticRegression from sklearn.metrics import roc_auc_sc...
Fewell asked 19/8, 2016 at 17:26

6

Solved

I couldn't find any one simple straightforward resource spelling out the meaning of and fix for the following BASH shell error, so I'm posting what I found after researching it. The error: -bash:...
Lantana asked 8/12, 2012 at 19:46

7

Solved

In Python I have a module myModule.py where I define a few functions and a main(), which takes a few command line arguments. I usually call this main() from a bash script. Now, I would like to pu...
Bly asked 24/1, 2013 at 11:23

6

Solved

I have a function that takes a member of a particular class: public function addPage(My_Page $page) { // ... } I'd like to make another function that takes an array of My_Page objects: public ...
Budbudapest asked 29/6, 2011 at 15:19

© 2022 - 2024 — McMap. All rights reserved.