Goto (Posting On Python-List Prohibited)

Chris Angelico rosuav at gmail.com
Sun Dec 31 12:06:43 EST 2017


On Mon, Jan 1, 2018 at 3:55 AM, bartc <bc at freeuk.com> wrote:
>> The suggestion was to use them to avoid gotos.  If duplicating is a good
>> idea (and it's a hard line to draw) then we are not talking about the
>> same cases.  Given the choice of "dragging in named functions" and
>> dragging in named blocks and gotos, I would choose the functions every
>> time.
>
>
> The blocks don't need to be dragged; they are already in place!
>
> It's funny because in c.l.c you're always advocating keep declarations as
> close to the point of use as possible. Here you appear to be saying the
> opposite: taking code away from the primary point of use.

I don't understand the issue here. All you need to do is add a "def"
statement header in front of the block of code. And maybe indent it
further, although if you're unifying "if/elif" subtrees, that'll
cancel out the indentation level change. The block of code stays at or
near its first use.

Once again, Bart, you're scorning something that you don't have much
(any?) experience with. Look at how the feature is used before you
hate on it.

ChrisA



More information about the Python-list mailing list