Idiosyncratic python
Mark Lawrence
breamoreboy at yahoo.co.uk
Thu Sep 24 19:40:11 EDT 2015
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 :)
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Python-list
mailing list