{
  "id": 339645,
  "title": "What does def () -->  :  mean in Python?",
  "url": "/competitions/mayo-clinic-strip-ai/discussion/339645",
  "author_name": "mbmlearner",
  "post_date": "2022-07-25T19:41:20.021000",
  "votes": 2,
  "comment_count": 6,
  "views": 0,
  "content": "<p>Several people are using def () --&gt; : in Python.  What is it called?  How  do  I learn how to do that to?</p>",
  "messages": [
    {
      "id": 1872141,
      "postDate": "2022-07-26T17:40:25.360Z",
      "content": "<p>These are known as type hints<br>\nwhen you mention<br>\ndef function_name(name: str) -&gt; str:<br>\n           \"\"\"Code Body\"\"\"</p>\n<p>This states that the function accepts an argument of type str ( in this case the name) and returns a value of type str (mentioned after the arrow)</p>",
      "rawMarkdown": "These are known as type hints\nwhen you mention\ndef function_name(name: str) -> str:\n           \"\"\"Code Body\"\"\"\n\nThis states that the function accepts an argument of type str ( in this case the name) and returns a value of type str (mentioned after the arrow)",
      "votes": 1
    },
    {
      "id": 1870762,
      "postDate": "2022-07-25T20:35:26.680Z",
      "content": "<p>They are knows are <a href=\"https://peps.python.org/pep-0484/\" target=\"_blank\">type hints</a></p>\n<p>Checkout this <a href=\"https://blog.jetbrains.com/pycharm/2015/11/python-3-5-type-hinting-in-pycharm-5/\" target=\"_blank\">blog</a> for detailed info </p>",
      "rawMarkdown": "They are knows are [type hints](https://peps.python.org/pep-0484/)\n\nCheckout this [blog](https://blog.jetbrains.com/pycharm/2015/11/python-3-5-type-hinting-in-pycharm-5/) for detailed info ",
      "votes": 1
    },
    {
      "id": 1872183,
      "postDate": "2022-07-26T17:55:20.353Z",
      "content": "<p>This is a type hint. It implies that the function will return a value of the type mentioned after the arrow.<br>\nFor example, if the function is defined as- def MyFunc(var1:str, var2:str) -&gt; float, it implies that the function returns a float value and accepts 2 strings. </p>",
      "rawMarkdown": "This is a type hint. It implies that the function will return a value of the type mentioned after the arrow.\nFor example, if the function is defined as- def MyFunc(var1:str, var2:str) -> float, it implies that the function returns a float value and accepts 2 strings. \n",
      "votes": 2
    },
    {
      "id": 1870741,
      "postDate": "2022-07-25T19:41:20.023Z",
      "content": "<p>Several people are using def () --&gt; : in Python.  What is it called?  How  do  I learn how to do that to?</p>",
      "rawMarkdown": "Several people are using def () --> : in Python.  What is it called?  How  do  I learn how to do that to?",
      "votes": 2
    },
    {
      "id": 1871448,
      "postDate": "2022-07-26T09:20:15.380Z",
      "content": "<p>It is used when you want to define a automated function. Go to Courses -&gt; Intro to Programming -&gt; Functions. It is explained there.</p>",
      "rawMarkdown": "It is used when you want to define a automated function. Go to Courses -> Intro to Programming -> Functions. It is explained there."
    },
    {
      "id": 1871263,
      "postDate": "2022-07-26T07:22:13.583Z",
      "content": "<p>(check this link)--&gt; <a href=\"url\" target=\"_blank\">https://www.programiz.com/python-programming/function</a></p>",
      "rawMarkdown": "(check this link)--> [https://www.programiz.com/python-programming/function](url)"
    },
    {
      "id": 1871238,
      "postDate": "2022-07-26T06:56:28.043Z",
      "content": "<p>def () -   A defining way.It defines a user defined function…</p>",
      "rawMarkdown": "def () -   A defining way.It defines a user defined function..."
    }
  ],
  "comments": [
    {
      "id": 1872141,
      "author_name": "Parthav Joshi",
      "author_url": "",
      "post_date": "2022-07-26T17:40:25.360000",
      "content": "<p>These are known as type hints<br>\nwhen you mention<br>\ndef function_name(name: str) -&gt; str:<br>\n           \"\"\"Code Body\"\"\"</p>\n<p>This states that the function accepts an argument of type str ( in this case the name) and returns a value of type str (mentioned after the arrow)</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1870762,
      "author_name": "Pathik Ghugare",
      "author_url": "",
      "post_date": "2022-07-25T20:35:26.680000",
      "content": "<p>They are knows are <a href=\"https://peps.python.org/pep-0484/\" target=\"_blank\">type hints</a></p>\n<p>Checkout this <a href=\"https://blog.jetbrains.com/pycharm/2015/11/python-3-5-type-hinting-in-pycharm-5/\" target=\"_blank\">blog</a> for detailed info </p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1872183,
      "author_name": "Ravi Ramakrishnan",
      "author_url": "",
      "post_date": "2022-07-26T17:55:20.353000",
      "content": "<p>This is a type hint. It implies that the function will return a value of the type mentioned after the arrow.<br>\nFor example, if the function is defined as- def MyFunc(var1:str, var2:str) -&gt; float, it implies that the function returns a float value and accepts 2 strings. </p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 1871448,
      "author_name": "Priyank Aggarwal",
      "author_url": "",
      "post_date": "2022-07-26T09:20:15.380000",
      "content": "<p>It is used when you want to define a automated function. Go to Courses -&gt; Intro to Programming -&gt; Functions. It is explained there.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 1871263,
      "author_name": "mohamed meqlad",
      "author_url": "",
      "post_date": "2022-07-26T07:22:13.583000",
      "content": "<p>(check this link)--&gt; <a href=\"url\" target=\"_blank\">https://www.programiz.com/python-programming/function</a></p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 1871238,
      "author_name": "VENNAPUSA SHIVA DIVYA",
      "author_url": "",
      "post_date": "2022-07-26T06:56:28.043000",
      "content": "<p>def () -   A defining way.It defines a user defined function…</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1872141": "These are known as type hints\nwhen you mention\ndef function_name(name: str) -> str:\n           \"\"\"Code Body\"\"\"\n\nThis states that the function accepts an argument of type str ( in this case the name) and returns a value of type str (mentioned after the arrow)",
    "1870762": "They are knows are [type hints](https://peps.python.org/pep-0484/)\n\nCheckout this [blog](https://blog.jetbrains.com/pycharm/2015/11/python-3-5-type-hinting-in-pycharm-5/) for detailed info ",
    "1872183": "This is a type hint. It implies that the function will return a value of the type mentioned after the arrow.\nFor example, if the function is defined as- def MyFunc(var1:str, var2:str) -> float, it implies that the function returns a float value and accepts 2 strings. \n",
    "1870741": "Several people are using def () --> : in Python.  What is it called?  How  do  I learn how to do that to?",
    "1871448": "It is used when you want to define a automated function. Go to Courses -> Intro to Programming -> Functions. It is explained there.",
    "1871263": "(check this link)--> [https://www.programiz.com/python-programming/function](url)",
    "1871238": "def () -   A defining way.It defines a user defined function..."
  }
}