Path: ...!3.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!.POSTED!not-for-mail From: Olivier Miakinen Newsgroups: fr.comp.lang.python Subject: Re: Signature d'une fonction Date: Fri, 6 Dec 2024 00:34:26 +0100 Organization: There's no cabale Lines: 28 Message-ID: References: <6750134f$0$12939$426a74cc@news.free.fr> <67504685$0$11432$426a34cc@news.free.fr> NNTP-Posting-Host: 200.89.28.93.rev.sfr.net Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit X-Trace: cabale.usenet-fr.net 1733441666 52142 93.28.89.200 (5 Dec 2024 23:34:26 GMT) X-Complaints-To: abuse@usenet-fr.net NNTP-Posting-Date: Thu, 5 Dec 2024 23:34:26 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.4 In-Reply-To: Bytes: 2366 Le 05/12/2024 22:59, Stefan Ram m'a répondu : > > Ouais, c'est ouf ! > > L'idée derrière tout ça, c'est que Python veut rester une > langue sans typage statique de base. On peut voir les types > comme des commentaires, .... ce qui est déjà une excellente idée. > ou utiliser des outils supplémentaires > pour vérifier les types. > > Un exemple, c'est « mypy ». [...] > > mypy: test.py:9: error: Incompatible return value type (got "str", expected "int") [return-value] > test.py:11: error: Argument 1 to "test" has incompatible type "int"; expected "str" [arg-type] > test.py:11: error: Argument 2 to "test" has incompatible type "str"; expected "int" [arg-type] > test.py:13: error: Argument 1 to "test" has incompatible type "int"; expected "str" [arg-type] > test.py:13: error: Argument 2 to "test" has incompatible type "str"; expected "int" [arg-type] > test.py:15: error: Argument 2 to "test" has incompatible type "str"; expected "int" [arg-type] > Found 6 errors in 1 file (checked 1 source file) Ah oui, très bien ! -- Olivier Miakinen