Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function parameters
#1
Hi Viewer,

While defining function parameters we should pass the dynamic keyword argument (**kwargs) at the end. Otherwise python throws a syntaxerror. Is it just that the syntax has been defined as such or is there any particular reason behind this.
Reply
#2
can you share your code (in code tags) that throws an error? Also include the full traceback in error tags
Reply
#3
It is defined by the syntax. It has always been like this. I suppose the reason is that arguments that come before are called "positional" arguments, and they need to be at a specific position.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question How to compare two parameters in a function that has *args? Milan 4 1,198 Mar-26-2023, 07:43 PM
Last Post: Milan
  function accepts infinite parameters and returns a graph with those values edencthompson 0 812 Jun-10-2022, 03:42 PM
Last Post: edencthompson
  How can I write a function with three parameters? MehmetAliKarabulut 1 2,377 Mar-04-2021, 10:47 PM
Last Post: Larz60+
  Parameters aren't seen inside function Sancho_Pansa 8 2,818 Oct-27-2020, 07:52 AM
Last Post: Sancho_Pansa
  RuntimeError: Optimal parameters not found: Number of calls to function has reached m bntayfur 0 6,073 Aug-05-2020, 04:41 PM
Last Post: bntayfur
  Function parameters and values as string infobound 1 1,729 Jul-24-2020, 04:28 AM
Last Post: scidam
  function 2 inside function 1 parameters SheeppOSU 4 2,798 Apr-20-2019, 09:34 PM
Last Post: snippsat
  Parameters for function in bind() kom2 1 2,255 Apr-18-2019, 03:59 PM
Last Post: woooee
  Parameters type in a function girbinho 2 2,698 Oct-09-2018, 10:36 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020