0

I just ran into a situation whereby I need to use a timedelta. I have only used timedelta once before, and I am using that piece of code as a reference point.

timedelta(**{unit_of_measurement:quantity_of_units})

I am simply curious what the **{var1:var2} part of the code is called?

I am new to Python, so I am not sure if it is exclusive to timedeltas, datetime, or Python in general. There is no mention of it in the datetime documentation. I have tried searching Google, but it returns completely irrelevant results.

oldboy
  • 5,729
  • 6
  • 38
  • 86
  • 1
    Please try to make titles specific enough that someone doesn't need to click through to be able to know what you're asking about. (In this case, I changed "This Piece Of Code" to `**{key:value}`). – Charles Duffy Sep 22 '18 at 23:43
  • @CharlesDuffy hard to make it specific when i have no idea what it is lol. i tried to make it as specific as possible – oldboy Sep 22 '18 at 23:44
  • 2
    Showing the actual syntax in the title is more specific than saying "this syntax" or "this code". To someone who's only seen the title, "this code" could be anything. – Charles Duffy Sep 22 '18 at 23:44
  • @CharlesDuffy duly noted – oldboy Sep 22 '18 at 23:44
  • 1
    It's called splatty splat: https://stackoverflow.com/q/22365847/2988730. And no one can ever tell me otherwise! – Mad Physicist Sep 22 '18 at 23:46
  • Remember, we want your question to help future readers as well as you. A title like "What Is This Unusual Piece of Code Called" is pretty useless in a Google search. ;) – PM 2Ring Sep 22 '18 at 23:51
  • @PM2Ring you never know lol when i searched for ***python **{x:y}*** nothing came up for me o: – oldboy Sep 23 '18 at 00:06

0 Answers0