[Tutor] Printing without a line feed

Mats Wichmann mats at wichmann.us
Thu Mar 25 19:49:52 EDT 2021


On 3/25/21 4:12 PM, Phil wrote:
> On 25/3/21 5:29 pm, Narasimharao Nelluri wrote:
> 
> Thank you all who offered a solution. It was the * operator that I'd 
> used previously but had forgotten. I've used the build-up-a-string 
> technique quite often. Join, being the opposite to split (which I've 
> used a lot) is a useful function that I will try to remember.


The packing/unpacking operators - * for lists/tuples and ** for dicts - 
are very useful and somehow hard to keep track of.  We know about them 
from the relatively standard form:

def func(foo, *args, **kwargs):

but it's not magic unique to function declarations/signatures, it's a 
general form usable in many places.

(okay, I'm speaking for myself, I have to keep reminding myself, but I 
keep seeing evidence it's probably a useful reminder for others as well).

Unfortunately docs on this packing/unpacking stuff are not as visible as 
they might be.


More information about the Tutor mailing list