{"action":"created","issue":{"url":"https://api.github.com/repos/Tset-Noitamotua/Sikuli-and-Robot-Framework-Integration/issues/9","labels_url":"https://api.github.com/repos/Tset-Noitamotua/Sikuli-and-Robot-Framework-Integration/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/Tset-Noitamotua/Sikuli-and-Robot-Framework-Integration/issues/9/comments","events_url":"https://api.github.com/repos/Tset-Noitamotua/Sikuli-and-Robot-Framework-Integration/issues/9/events","html_url":"https://github.com/Tset-Noitamotua/Sikuli-and-Robot-Framework-Integration/issues/9","id":56994594,"number":9,"title":"How to pass *args with a default value","user":{"login":"Tset-Noitamotua","id":5635462,"avatar_url":"https://avatars.githubusercontent.com/u/5635462?v=3","gravatar_id":"","url":"https://api.github.com/users/Tset-Noitamotua","html_url":"https://github.com/Tset-Noitamotua","followers_url":"https://api.github.com/users/Tset-Noitamotua/followers","following_url":"https://api.github.com/users/Tset-Noitamotua/following{/other_user}","gists_url":"https://api.github.com/users/Tset-Noitamotua/gists{/gist_id}","starred_url":"https://api.github.com/users/Tset-Noitamotua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tset-Noitamotua/subscriptions","organizations_url":"https://api.github.com/users/Tset-Noitamotua/orgs","repos_url":"https://api.github.com/users/Tset-Noitamotua/repos","events_url":"https://api.github.com/users/Tset-Noitamotua/events{/privacy}","received_events_url":"https://api.github.com/users/Tset-Noitamotua/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Tset-Noitamotua/Sikuli-and-Robot-Framework-Integration/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-09T06:37:11Z","updated_at":"2015-02-24T09:50:19Z","closed_at":null,"body":"This is not a SikuliX specific question - just a programming question of a beginner :)\r\n\r\nI have a function / method like this:\r\n\r\n```python\r\ndef do(*args):\r\n    # timeout value\r\n    print \"timeout is %i\" % args[3]\r\n\r\n    # action can be click, doubleclick, rightclick\r\n    action = args[0]\r\n    if args[0] == 'click':\r\n        action = click\r\n    elif args[0] == 'doubleclick':\r\n        action = doubleClick\r\n    elif args[0] == 'rightclick':\r\n        action = rightClick\r\n\r\n    # perform action e.g.\r\n    # click image\r\n    action((args[1]))\r\n\r\n    # check post condition --> (args[2]) until timeout --> args[3])\r\n    if exists((args[2]), (args[3])):\r\n        pass\r\n    else:\r\n        print \"FAIL! Wrong post condition!\"\r\n```\r\n\r\nAnd I call it with that:\r\n```python\r\n#  args[0] -> action | args[1] -> image to click | args[2] -> image to check\r\n#  condition after action | args[3] -> timeout for exists()\r\ndo('click', \"path_to/image_of_gui_element.png\", \"path_to/image_of_post_condition.png\", 5)\r\n```\r\n\r\n**Now my question:**\r\nHow can I set timeout argument ```agrs[3]``` to a default value (of e.g. 5 seconds) so that I don´t have to write it each time I call my ```do``` function?"},"comment":{"url":"https://api.github.com/repos/Tset-Noitamotua/Sikuli-and-Robot-Framework-Integration/issues/comments/75727121","html_url":"https://github.com/Tset-Noitamotua/Sikuli-and-Robot-Framework-Integration/issues/9#issuecomment-75727121","issue_url":"https://api.github.com/repos/Tset-Noitamotua/Sikuli-and-Robot-Framework-Integration/issues/9","id":75727121,"user":{"login":"RaiMan","id":586370,"avatar_url":"https://avatars.githubusercontent.com/u/586370?v=3","gravatar_id":"","url":"https://api.github.com/users/RaiMan","html_url":"https://github.com/RaiMan","followers_url":"https://api.github.com/users/RaiMan/followers","following_url":"https://api.github.com/users/RaiMan/following{/other_user}","gists_url":"https://api.github.com/users/RaiMan/gists{/gist_id}","starred_url":"https://api.github.com/users/RaiMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RaiMan/subscriptions","organizations_url":"https://api.github.com/users/RaiMan/orgs","repos_url":"https://api.github.com/users/RaiMan/repos","events_url":"https://api.github.com/users/RaiMan/events{/privacy}","received_events_url":"https://api.github.com/users/RaiMan/received_events","type":"User","site_admin":false},"created_at":"2015-02-24T09:50:19Z","updated_at":"2015-02-24T09:50:19Z","body":"Interesting - looks good.\r\n\r\nI just made a similar approach (varargs) to support running scripts and snippets written in JavaScript (the engine is contained in Java, so no external interpreter is needed).\r\n\r\nThis will become an additional generic API in version 2, to access the SikuliX features from anywhere.\r\n\r\nkeep up with your approach. welcome for any help you need."}}