{"id":1139,"date":"2019-04-13T16:34:49","date_gmt":"2019-04-13T14:34:49","guid":{"rendered":"https:\/\/www.mathweb.fr\/euclide\/?p=1139"},"modified":"2022-06-30T11:27:32","modified_gmt":"2022-06-30T09:27:32","slug":"python-et-fonction-a-nombre-variable-darguments","status":"publish","type":"post","link":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/","title":{"rendered":"Python et fonction \u00e0 nombre variable d&rsquo;arguments"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Voici une astuce qui pourra sans doute servir \u00e0 plusieurs d&rsquo;entre vous : je vais vous parler des fonctions Python qui peuvent admettre un nombre variable d&rsquo;arguments.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables-1024x640.png\" alt=\"fonction Python \u00e0 un nombre variable d'arguments\" class=\"wp-image-2873\" srcset=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables-1024x640.png 1024w, https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables-300x188.png 300w, https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables-600x375.png 600w, https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables-768x480.png 768w, https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables.png 1080w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>fonction Python \u00e0 un nombre variable d&rsquo;arguments<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Une fonction peut quelques fois devoir prendre un nombre variable d&rsquo;arguments. Par exemple, si l&rsquo;on souhaite calculer le PGCD de plusieurs nombres, on aimerait que la fonction PGCD (par exemple) accepte 2, 3, 4, &#8230; arguments.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-white ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Au menu sur cette page...<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#Calcul_du_PGCD_de_plusieurs_nombres\" >Calcul du PGCD de plusieurs nombres<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#Somme_de_plusieurs_nombres\" >Somme de plusieurs nombres<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#Un_exemple_basique_avec_double_splat\" >Un exemple basique avec double splat<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#Melange_de_splat_et_double_splat\" >M\u00e9lange de splat et double splat<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Calcul_du_PGCD_de_plusieurs_nombres\"><\/span>Calcul du PGCD de plusieurs nombres<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Voici sur un exemple comment faire:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def pgcd(*n):\n\tdef _pgcd(a,b):\n\t\twhile b!=0:\n\t\t\ta,b = b,a%b\n\t\treturn a\n\tp = _pgcd(n[0],n[1])\n\tfor x in n[2:]:\n\t\tp = _pgcd(p,x)\n\treturn p\n\nprint(pgcd(165,515,225,65))<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Cette m\u00e9thode s&rsquo;appelle l&rsquo;<em>unpacking<\/em>. Regardons \u00e0 travers un deuxi\u00e8me exemple.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Somme_de_plusieurs_nombres\"><\/span>Somme de plusieurs nombres<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On va d\u00e9finir ici une fonction \u00ab\u00a0somme\u00a0\u00bb:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def somme(*n):\n    return sum(s)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Cette fonction permet de calculer la somme d&rsquo;un nombre variable d&rsquo;arguments. Par exemple:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"false\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">somme(1,2,3,4,5)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">retourne $$1+2+3+4+5=15.$$Et:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"false\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">somme(15,12,2,20,12,1,2)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">retourne:$$15+12+2+20+12+1+2=64.$$<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>1 splat (1 \u00e9toile) : liste<\/li><li>2 splats (2 \u00e9toiles) : dictionnaire<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">En effet, si l&rsquo;on souhaite r\u00e9cup\u00e9rer les arguments dans un dictionnaire, on utilise le double splat.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Un_exemple_basique_avec_double_splat\"><\/span>Un exemple basique avec double splat<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def fonction(**kwargs):\n    for key,value in kwargs.items():\n        print('{} -> {}'.format(key,value))\n\nfonction(a = 1, b = 2, c = 5)<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">a -&gt; 1\nb -&gt; 2\nc -&gt; 5<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u00c0 travers cet exemple, on voit bien le fonctionnement de l&rsquo;unpacking avec le double splat. Il est \u00e0 noter qu&rsquo;en g\u00e9n\u00e9ral, on note <em>kwargs<\/em> pour le double splat (contraction de \u00ab\u00a0keyword arguments\u00a0\u00bb), mais ce n&rsquo;est pas obligatoire.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On peut aussi m\u00e9langer le splat et le double splat.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Melange_de_splat_et_double_splat\"><\/span>M\u00e9lange de splat et double splat<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def fonction(*args , **kwargs):\n    for i in args:\n        print(i)\n    for key,value in kwargs.items():\n        print('{} -> {}'.format(key,value))\n        \nfonction(48 , 52 , 63 , a = 1, b = 2, c = 5)<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">48\n52\n63\na -&gt; 1\nb -&gt; 2\nc -&gt; 5<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Voici une astuce qui pourra sans doute servir \u00e0 plusieurs d&rsquo;entre vous : je vais vous parler des fonctions Python qui peuvent admettre un nombre variable d&rsquo;arguments. Une fonction peut quelques fois devoir prendre un nombre variable d&rsquo;arguments. Par exemple, si l&rsquo;on souhaite calculer le PGCD de plusieurs nombres, on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[218,217],"class_list":["post-1139","post","type-post","status-publish","format-standard","hentry","category-informatique","category-python","tag-kwargs","tag-splat"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python et fonction \u00e0 nombre variable d&#039;arguments - Mathweb.fr<\/title>\n<meta name=\"description\" content=\"Je vais ici vous parler des fonctions Python qui peuvent admettre un nombre variable d&#039;arguments. Nous allons voir comment.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python et fonction \u00e0 nombre variable d&#039;arguments - Mathweb.fr\" \/>\n<meta property=\"og:description\" content=\"Je vais ici vous parler des fonctions Python qui peuvent admettre un nombre variable d&#039;arguments. Nous allons voir comment.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/\" \/>\n<meta property=\"og:site_name\" content=\"Mathweb.fr\" \/>\n<meta property=\"article:published_time\" content=\"2019-04-13T14:34:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-30T09:27:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables-1024x640.png\" \/>\n<meta name=\"author\" content=\"St\u00e9phane Pasquet\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"St\u00e9phane Pasquet\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/\"},\"author\":{\"name\":\"St\u00e9phane Pasquet\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#\\\/schema\\\/person\\\/e4d3bb07968238378f0d5052a70dcd69\"},\"headline\":\"Python et fonction \u00e0 nombre variable d&rsquo;arguments\",\"datePublished\":\"2019-04-13T14:34:49+00:00\",\"dateModified\":\"2022-06-30T09:27:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/\"},\"wordCount\":219,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#\\\/schema\\\/person\\\/e4d3bb07968238378f0d5052a70dcd69\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Python-fonction-plusieurs-variables-1024x640.png\",\"keywords\":[\"kwargs\",\"splat\"],\"articleSection\":[\"Informatique\",\"Python\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/\",\"url\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/\",\"name\":\"Python et fonction \u00e0 nombre variable d'arguments - Mathweb.fr\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Python-fonction-plusieurs-variables-1024x640.png\",\"datePublished\":\"2019-04-13T14:34:49+00:00\",\"dateModified\":\"2022-06-30T09:27:32+00:00\",\"description\":\"Je vais ici vous parler des fonctions Python qui peuvent admettre un nombre variable d'arguments. Nous allons voir comment.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Python-fonction-plusieurs-variables.png\",\"contentUrl\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Python-fonction-plusieurs-variables.png\",\"width\":1080,\"height\":675},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/04\\\/13\\\/python-et-fonction-a-nombre-variable-darguments\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python et fonction \u00e0 nombre variable d&rsquo;arguments\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#website\",\"url\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/\",\"name\":\"Mathweb.fr\",\"description\":\"Math\u00e9matiques, LaTeX et Python\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#\\\/schema\\\/person\\\/e4d3bb07968238378f0d5052a70dcd69\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#\\\/schema\\\/person\\\/e4d3bb07968238378f0d5052a70dcd69\",\"name\":\"St\u00e9phane Pasquet\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-logo-mathweb.webp\",\"url\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-logo-mathweb.webp\",\"contentUrl\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-logo-mathweb.webp\",\"width\":74,\"height\":77,\"caption\":\"St\u00e9phane Pasquet\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-logo-mathweb.webp\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python et fonction \u00e0 nombre variable d'arguments - Mathweb.fr","description":"Je vais ici vous parler des fonctions Python qui peuvent admettre un nombre variable d'arguments. Nous allons voir comment.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/","og_locale":"fr_FR","og_type":"article","og_title":"Python et fonction \u00e0 nombre variable d'arguments - Mathweb.fr","og_description":"Je vais ici vous parler des fonctions Python qui peuvent admettre un nombre variable d'arguments. Nous allons voir comment.","og_url":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/","og_site_name":"Mathweb.fr","article_published_time":"2019-04-13T14:34:49+00:00","article_modified_time":"2022-06-30T09:27:32+00:00","og_image":[{"url":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables-1024x640.png","type":"","width":"","height":""}],"author":"St\u00e9phane Pasquet","twitter_card":"summary_large_image","twitter_misc":{"\u00c9crit par":"St\u00e9phane Pasquet","Dur\u00e9e de lecture estim\u00e9e":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#article","isPartOf":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/"},"author":{"name":"St\u00e9phane Pasquet","@id":"https:\/\/www.mathweb.fr\/euclide\/#\/schema\/person\/e4d3bb07968238378f0d5052a70dcd69"},"headline":"Python et fonction \u00e0 nombre variable d&rsquo;arguments","datePublished":"2019-04-13T14:34:49+00:00","dateModified":"2022-06-30T09:27:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/"},"wordCount":219,"commentCount":0,"publisher":{"@id":"https:\/\/www.mathweb.fr\/euclide\/#\/schema\/person\/e4d3bb07968238378f0d5052a70dcd69"},"image":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables-1024x640.png","keywords":["kwargs","splat"],"articleSection":["Informatique","Python"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/","url":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/","name":"Python et fonction \u00e0 nombre variable d'arguments - Mathweb.fr","isPartOf":{"@id":"https:\/\/www.mathweb.fr\/euclide\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#primaryimage"},"image":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables-1024x640.png","datePublished":"2019-04-13T14:34:49+00:00","dateModified":"2022-06-30T09:27:32+00:00","description":"Je vais ici vous parler des fonctions Python qui peuvent admettre un nombre variable d'arguments. Nous allons voir comment.","breadcrumb":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#primaryimage","url":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables.png","contentUrl":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2020\/07\/Python-fonction-plusieurs-variables.png","width":1080,"height":675},{"@type":"BreadcrumbList","@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/04\/13\/python-et-fonction-a-nombre-variable-darguments\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.mathweb.fr\/euclide\/"},{"@type":"ListItem","position":2,"name":"Python et fonction \u00e0 nombre variable d&rsquo;arguments"}]},{"@type":"WebSite","@id":"https:\/\/www.mathweb.fr\/euclide\/#website","url":"https:\/\/www.mathweb.fr\/euclide\/","name":"Mathweb.fr","description":"Math\u00e9matiques, LaTeX et Python","publisher":{"@id":"https:\/\/www.mathweb.fr\/euclide\/#\/schema\/person\/e4d3bb07968238378f0d5052a70dcd69"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mathweb.fr\/euclide\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":["Person","Organization"],"@id":"https:\/\/www.mathweb.fr\/euclide\/#\/schema\/person\/e4d3bb07968238378f0d5052a70dcd69","name":"St\u00e9phane Pasquet","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2025\/06\/cropped-logo-mathweb.webp","url":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2025\/06\/cropped-logo-mathweb.webp","contentUrl":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2025\/06\/cropped-logo-mathweb.webp","width":74,"height":77,"caption":"St\u00e9phane Pasquet"},"logo":{"@id":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2025\/06\/cropped-logo-mathweb.webp"}}]}},"_links":{"self":[{"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/posts\/1139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/comments?post=1139"}],"version-history":[{"count":0,"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/posts\/1139\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/media?parent=1139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/categories?post=1139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/tags?post=1139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}