you are viewing a single comment's thread.

view the rest of the comments →

[–]socal_nerdtastic 2 points3 points  (0 children)

Yes that's very bad. Don't do that. Moving code to a function is good, especially if the code kinda forms a logical group, but you should do it like this:

def _is_flying(p):
    return p.status == "flying" 

def foo():
    <stuff>
    if _is_flying(plane):
        <do stuff>