Curiosity question on signatures

  • Thread starter Gonçalo Rodrigues
  • Start date
G

Gonçalo Rodrigues

Hi all,

I just noticed the following fact:
.... print "Arg is %s." % arg
.... Arg is 0.

Even "worse":
.... print "Args: %s, %s." % (arg1, arg2)
....
Does this "feature" of being able to treat positional arguments as
named arguments have any use? Does anybody make any use of it? Is
there any rationale on why it's in the language?

I'm asking this, because if we define equivalence of functions
signatures in the obvious way ("they accept the same calls") then

def f(arg):
....

def g(name):
....

don't have equivalent signatures because f can be called with (arg =
0) which does not work with g. It looks... wrong (maybe because what I
have in my mind is the mathematical concept of a function where named
arguments do not exist).

This is no big deal of course, just a curiosity.

With my best regards,
G. Rodrigues
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top