Bifalgorithm post

Why do Python developers write star args and double star quarks? Look at this code, def function, star args, double star, quarks. Be honest, how many times have you seen this and just copied it without understanding it? Why the stars? Why these weird names? And what do they actually do? Here's the interesting part. Star args lets a function accept many values without knowing exactly how many you will pass. For example, one value, three values, 10 values. Python collects them all into one place. And DoubleStarQuargs does something similar, but for named values, like name, age, email. Instead of collecting simple values, it collects labeled values. So the easiest way to think about them is this. Star args collects extra values. Double star quarks collects extra named values. And once you understand that, a lot of Python code suddenly becomes much less scary. Now I want to know, did args and cargs confuse you when you first saw them? Write your answer in the comments.

Why do Python developers write star args and double star quarks? Look at this code, def function, star args, double star, quarks. Be honest, how many times hav…

Ideas in this flowchart

  • Understanding Star Args and Double Star Quargs in Python
  • Purpose of Star Args
  • Accepts Many Values
  • Collects Values
  • Purpose of Double Star Quargs
  • Accepts Named Values
  • Collects Labeled Values
  • Common Confusion
  • Understanding Reduces Fear
  • User Experience
Feed/

Why do Python developers write star args and double star quarks? Look at this code, def function, star args, double star, quarks. Be honest, how many times have you seen this and just copied it without understanding it? Why the stars? Why these weird names? And what do they actually do? Here's the interesting part. Star args lets a function accept many values without knowing exactly how many you will pass. For example, one value, three values, 10 values. Python collects them all into one place. And DoubleStarQuargs does something similar, but for named values, like name, age, email. Instead of collecting simple values, it collects labeled values. So the easiest way to think about them is this. Star args collects extra values. Double star quarks collects extra named values. And once you understand that, a lot of Python code suddenly becomes much less scary. Now I want to know, did args and cargs confuse you when you first saw them? Write your answer in the comments.

"Why do Python developers write star args and double star quarks?"

👍
0
0 comments0 shares

Sign in to view and post comments.