3 ms·
It's not something I see all the time, but using a dictionary instead of a big if/else is something that I'd consider a Python idiom, yes. And it's something I
by ubernostrum 12y ago
It's not something I see all the time, but using a dictionary instead of a big if/else is something that I'd consider a Python idiom, yes.
And it's something I do on occasion. For example:
https://github.com/ubernostrum/webcolors/blob/master/webcolors.py#L358 https://github.com/ubernostrum/webcolors/blob/master/webcolo...