Mark Lawrence <breamore...@yahoo.co.uk> writes: > On 24/09/2015 07:02, Steven D'Aprano wrote: >> I was looking at an in-house code base today, and the author seems to have a >> rather idiosyncratic approach to Python. For example: >> >> for k, v in mydict.items(): >> del(k) >> ... >> >> instead of the more obvious >> >> for v in mydict.values(): >> ... >> >> What are your favorite not-wrong-just-weird Python moments? >> > > My favourite was from a guy I worked with years ago. In C but I'm > sure you'll enjoy it. In all functions, something like:- > > int flag = 0; > if flag { > printf("\nthe string"); > } > else{ > printf("the string"); > flag = 1; > } > > At least I think I've got it correct, too lazy to check, sorry :)
It looks like a sys.stdout.softspace hack in Python 2: print line, # comma! -- https://mail.python.org/mailman/listinfo/python-list