Could someone explain the differences to me? Aren't all arguments "keyword arguments"? They all have names, and can all be assigned by that name instead of the position. Do keyword arguments mean ones with default values? (Note: I'm talking about pure python, no C)
Thanks.
EDIT: I just realized there's two types of each:
def func(*arg...
I am creating an ActiveX library in Delphi in which a particular object has a property called DevelopmentCount with a single parameter of type date. Internally the property getter calls a similarly named function on a normal Delphi object where the single parameter is optional (this last factor may be irrelevant).
When we compile this l...
I would like to know if there is anyway I can set one of my stored procedure parameter as optional.
IF @thing_id <> ''
BEGIN
SET @sFiltre = @sFiltre + ' AND OPERES.OPE_THING = ' + CONVERT(VARCHAR,@thing_id)
END
...
I'm working on rewriting a C program in C++ to take advantage of OO aspects so it can easily support multiple devices, and one part of the program is an expression evaluator. Expressions can have function calls, and here's the structure for functions.
typedef struct {
char *name;
int argc;
void (*func) ();
} FUNCTION;
Some...
I'm currently working on cleaning up an API full of function templates, and had a strong desire to write the following code.
template <typename T, typename U, typename V>
void doWork(const T& arg1, const U& arg2, V* optionalArg = 0);
When I invoke this template, I would like to do so as follows.
std::string text("hello");
doWork(100,...
Is there any design reason for that(like the reason they gave up multi inheritance)?
or it just wasn't important enough?
and same question applies for optional parameters in methods... this was already in the first version of vb.net... so it surely no laziness that cause MS not to allow optional parameters, probably architecture decisi...
I want to build a webservice with this signature, which does not throw an exception if param2 is left empty. Is this possible?
[WebMethod]
public string HelloWorld(string param1, bool param2){}
The exception is a System.ArgumentException that is thrown when trying to convert the empty string to boolean.
Ideas that have not worked so ...
Hi everyone,
I'm writing some code that updates a table. Depending on what the user wants to do, it either updates a large set of records, or a smaller one. The delineating factor is a group ID.
The user can choose whether to update the table for all records, or just those with that groupID. I'd like to use the same stored procedu...
I want to write an average method in java such that it can consume N amount of items, returning the average of them:
My idea was:
public static int average(int[] args){
int total = 0;
for(int i=0;i<args.length;i++){
total = total + args[i];
}
return Math.round (total/args.length);
}
//test it
average(1...
What's the best way to handle adding a new (optional) parameter to an existing opertion without requiring the client to update their WSDL? I do not want to update the namespace to describe a new version of the service contracts, since this should be backwards compatible with older clients.
Should I add a new operation with a new paramet...
I have an MVC application and I want to use this ? option.
Please tell me how I can do this. I have written:
int? isfeature;
but, while inserting the value in database, how do I use it?
It is giving following error:
Cannot convert from 'int?' to 'int'.
...
SCENARIO
I'm writing a cmdlet for Powershell 2.0 using Visual Studio 2008 and .NET 3.5
the cmdlet requires 3 arguments.
my intended grammar of the cmdlet is something like this:
cmdletname [foo|bar] p1, p2
That reads as the user must give a value for "-foo" or "-bar" but can't give both together.
EXAMPLE OF VALID INPUT
cmdle...
Hi
I'm trying to write a function in a CodeIgniter controller which can take optional parameters. However, I always get Missing Argument warnings. I'm not trying to suppress the warnings - I'm trying to declare the parameters as optional (maybe they could be empty strings if they don't exist, or something).
What is it I'm missing?
Tha...
This is kind of complicated so please bear with me.
The Setup
most of our code base is in VB.net. I'm developing a project in c# that uses a lot of the assemblies from the VB.net code.
There are three relevant classes in VB.net
Public MustInherit Class mdTable
Public Sub New(ByVal sqlConnectionStr As String, Optional ByVal maxSec...
How can I create a nullable numeric optional parameter in VB.NET?
...
hi
Is there any way to send null to an optional stored procedure parameter via crystal reports8.5 and vb6? I use CRXParamDef.AddCurrentValue method to send stored procedure parameter values.
...
Both of these generate an error saying they must be a compile-time constant:
void Foo(TimeSpan span = TimeSpan.FromSeconds(2.0))
void Foo(TimeSpan span = new TimeSpan(2000))
First of all, can someone explain why these values can't be determined at compile time? And is there a way to specify a default value for an optional TimeSpan obj...
I asked a question about deserializing based on an attribute with data contracts. Apparently this isnt possible so I have to convert my DataContract to use XmlElement's (see http://stackoverflow.com/questions/2177079/net-represent-xml-in-class-without-xsd)
I'm assuming datacontracts cannot intermingle with xmlelements. How can I define...
I have a form with various inputs. I have a bunch of optional parameters that have some number of choices. I'd like to allow the user to select these optional parameters in the following way:
First, the user clicks the Add Component button at the bottom of the form and two new dropdowns appear above the button. The first dropdown has...
I want to know how to call a function, passing a parameter that it might not be expecting.
I faced this problem a few days ago, and found a way around it. But today, I decided I'd see if what I wanted to do was possible. Unfortunately, I don't remember the context which I used it in. So here is a stupid example in which there are plenty...