Python Forum
Is there a goto like there is in BASIC?
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there a goto like there is in BASIC?
#21
Quote:and direct or indirect recursion
That sounds like that 'advice' many tried to give me about overriding classes in C++, and especially bad they would tout was multiple inheritance.
Don't hear any of that much anymore
There are certain things that recursion does that I can't really imagine doing any other way.
Reply
#22
(Apr-22-2017, 12:01 AM)Larz60+ Wrote: There are certain things that recursion does that I can't really imagine doing any other way.
Anything recursive can be written in an iterative fashion. You might have to manage a stack manually, but it's always doable.

While I believe "indirect" (or "mutual") recursion is playing with fire, and I regret deeply the one time I tried it, "direct" or regular recursion has a learning curve to it but is arguably better than using break or continue in a loop. CPython lacks optimizations for recursion, but as a style of control flow it can be an elegant way to avoid side effects.
Reply
#23
Use it all the time, hasn't burnt me yet!
Reply
#24
A trampoline can replace recursion, though I think that just counts as indirect recursion.
Reply
#25
Nist recommends recursion for fsclm_DeriveSymmetricKeys

See page 32: http://csrc.nist.gov/groups/STM/cmvp/doc...0sp437.pdf

When used, you can have a good idea of maximum depths, and can limit it as well.

I agree that it's better avoided if possible, but I still feel it has uses, as here.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  goto jmabrito 34 10,208 Feb-18-2021, 09:55 PM
Last Post: jmabrito
  How to make input goto a different line mxl671 2 2,456 Feb-04-2020, 07:12 PM
Last Post: Marbelous
  goto problem Skaperen 1 2,733 Jan-27-2018, 01:11 PM
Last Post: stranac
  Go up script/menu(a goto command) foxtreat 7 8,211 Apr-24-2017, 05:58 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020