On Sun, Dec 31, 2017 at 10:45 AM, bartc <b...@freeuk.com> wrote: > On 30/12/2017 23:26, Gregory Ewing wrote: >> >> bartc wrote: >>> >>> B and C occur twice, so a goto is a quick way to reuse B and C without >>> needing to duplicate code, >> >> >> This only works if the repeated part happens to be at the >> tail of each case. > > > IME that seems to be the most common situation. >
I've written code that uses dirty tricks like that to avoid duplication. It's at least as much of a problem as actual duplication is. Generally, the 'goto' solution results in subsequent programmers (such as my future selves) staring at the code for 30-60 seconds to figure out what it's doing. I don't like to do that to myself, much less to people I actually admire and respect. ChrisA -- https://mail.python.org/mailman/listinfo/python-list