[Python-ideas] Inline Functions - idea
Paul Moore
p.f.moore at gmail.com
Wed Feb 5 16:21:35 CET 2014
On 5 February 2014 15:15, Alex Rodrigues <lemiant at hotmail.com> wrote:
> As to why I didn't use an "or" in the original example. I am aware that the
> example doesn't actually need an inline function, but it demonstrates the
> concept in a simple way (so that it would fit in an email). Most use-cases
> are more complicated, often the spots where you want to execute the same
> code are buried inside long, branching logic statements where other things
> are going on, making restructuring the code much less trivial, if not
> impossible.
That sounds to me like your function is so complex that it should
probably have been refactored long before you got to the point of
needing your inline function. Possibly by factoring out the
conditional testing to a separate function. Of course, that sort of
thing is always easier said than done, I know :-)
Paul
More information about the Python-ideas
mailing list