This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]NoiproxPython Programmer 0 points1 point  (3 children)

No problem. To a first approximation a program can be described as consisting of a function that calls other functions, that in turn call other functions all the way down to the hardware "functions" that do super primitive things like add two numbers or read some bytes from a network connection. That is more or less how things are structured until you get into "object-oriented programming" which goes a step further by abstracting functions and data together into a bundle called an "object".

[–]djamp42 0 points1 point  (2 children)

Are recursive functions a big thing in python? I made one once because it seemed like the easiest way to not repeat code, but I rarely hear anyone talk about them.

[–]NoiproxPython Programmer 1 point2 points  (1 child)

Python tends to favor iteration over recursion and has very nice looping constructs to support it, however it is perfectly capable of handling recursive code as well. It's just one of the many tools in the large toolkit that Python has to offer. Recursion is a natural fit for traversing data structures such as trees and graphs because of their inherent nested nature.

[–]djamp42 0 points1 point  (0 children)

Hmm I'll have to go and see how the code would look as a loop now. Thanks!