Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>i am pretty sure that the reason people "naturally" don't like this is because it makes the meaning of later arguments ambiguous, depending on the length of the interpolated series:</p> <pre><code>def dangerbaby(a, b, *c): hug(a) kill(b) &gt;&gt;&gt; dangerbaby('puppy', 'bug') killed bug &gt;&gt;&gt; cuddles = ['puppy'] &gt;&gt;&gt; dangerbaby(*cuddles, 'bug') killed bug &gt;&gt;&gt; cuddles.append('kitten') &gt;&gt;&gt; dangerbaby(*cuddles, 'bug') killed kitten </code></pre> <p>you cannot tell from just looking at the last two calls to <code>dangerbaby</code> which one works as expected and which one kills little kitten fluffykins.</p> <p>of course, some of this uncertainty is also present when interpolating at the end. but the confusion is constrained to the interpolated sequence - it doesn't affect other arguments, like <code>bug</code>.</p> <p>[i made a quick search to see if i could find anything official. it seems that the * prefix for varags was <a href="http://www.python.org/search/hypermail/python-1993/0001.html" rel="noreferrer">introduced in python 0.9.8</a>. the previous syntax is <a href="http://www.python.org/search/hypermail/python-1992/0260.html" rel="noreferrer">discussed here</a> and the rules for how it worked were rather complex. since the addition of extra arguments "had to" happen at the end when there was no * marker it seems like that simply carried over. finally there's a <a href="http://www.python.org/search/hypermail/python-1992/0292.html" rel="noreferrer">mention here</a> of a long discussion on argument lists that was not by email.]</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload