-6

There are two tags, and

For me these are two synonyms. Should we make a synonym?

There seems to be differences between different programming languages. In Ruby the official documentation uses keyword-argument, but in discussions named parameters is also used. (Example: How can Ruby functions with named arguments get called with a hash instead?)

If not, can we adapt the information of the two tags to clarify the difference.

Remarks:

3
  • What would you suggest the target tag would be? (and why) May 16, 2019 at 10:01
  • 4
    Not synonyms, "keyword argument" is specific to Python and Ruby. While they cover the same concept, for example a C# or VB programmer would not have a shot at guessing what it could mean. The primary language tag avoids them getting mixed up. May 16, 2019 at 10:40
  • @JonClements To be honest, up to now I have no preference. I see the problem but I feel not competent to decide it. As a ruby developper I prefer the keyword argument, but I think I'm not objective for this :) . I want to wait if we get some more opinions. Maybe we have only to adapt the tag description. (Something like _similar concepts are called XXX in ...)
    – knut
    May 16, 2019 at 19:11

1 Answer 1

1

Keyword Arguments appear to offer more functionality than a Named Parameter does. For example with Keyword Arguments you don't have to specify what the names are in the code however with a Named Parameter it would be expected to be predefined what the name is when writing the code.

Taken from the accepted answer on Normal arguments vs. keyword arguments

The other concept is on the function definition side: You can define a function that takes parameters by name -- and you don't even have to specify what those names are. These are pure keyword arguments, and can't be passed positionally. The syntax is

def my_function(arg1, arg2, **kwargs)

Any keyword arguments you pass into this function will be placed into a dictionary named kwargs. You can examine the keys of this dictionary at run-time, like this:

def my_function(**kwargs):
    print str(kwargs)

my_function(a=12, b="abc")

{'a': 12, 'b': 'abc'}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .