jquast / x84

A python telnet/ssh server for modern terminals. In spirit of classic software such as ami/x, teleguard, renegade, iniquity.
http://x84.readthedocs.org/
Other
373 stars 56 forks source link

Update Session.py to remove extra args #230 #259

Closed crb02005 closed 9 years ago

crb02005 commented 9 years ago

Partially resolves issue with calling script with extra arguments.

landscape-bot commented 9 years ago

Code Health Code quality remained the same when pulling 4be1927 on crb02005:patch-1 into d6ea476 on jquast:master.

jquast commented 9 years ago

Do I understand the intent correctly?

To allow a main() function receiving no arguments to be called with arguments (arguments will be discarded)

If this is the case, why can't you just write a function like:

def main(*args, **kwargs):
    ("and ignore the the value of args, kwargs")

?

crb02005 commented 9 years ago

If you own all the scripts this function calls, they can be modified to support that. Is this ever going to call an external script? On Mar 3, 2015 11:39 PM, "Jeff Quast" notifications@github.com wrote:

Do I understand the intent correctly?

To allow a main() function receiving no arguments to be called with arguments (arguments will be discarded)

If this is the case, why can't you just write a function like:

def main(_args, *_kwargs): ("and ignore the the value of args, kwargs")

?

— Reply to this email directly or view it on GitHub https://github.com/jquast/x84/pull/259#issuecomment-77100273.

jquast commented 9 years ago

I don't follow, maybe you can provide a more precise use-case? Maybe we're not attacking the real problem here.

def function():
    return 1

function(33, 99, some_keyword=101)

Why would you believe the above code should execute ?? It should absolutely fail. You've provided arguments that you certainly thought were expected and required.

"Explicit is better than Implicit"

I can't accept this:

crb02005 commented 9 years ago

You are absolute right.