Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
2k views

Cons List in Python

It make sense to not allow links to external code hosting, so I restated my question. This is classical cons list in python using Abstract Base Class interface. Constructor is in fact out of the Cons ...
Robert Hanigan's user avatar
7 votes
2 answers
854 views

Recursive higher-order function

I have implemented a through function for myself in a project. Since I am still quite new in python and want to learn it correctly, I would be happy about any ...
mcocdawc's user avatar
  • 974
1 vote
2 answers
177 views

A double search function that looks in a list for one value and then the other alternatively

I'm writing in Python (3.4) a double search function that looks in a list for one value and then the other alternatively. That is, start searching the second value once you find first the first value (...
pa7x1's user avatar
  • 13
3 votes
3 answers
3k views

Primality test using recursion

For the given below exercise: Here is one method to check if a number is prime: ...
overexchange's user avatar
  • 3,401
6 votes
1 answer
979 views

Functional, but not recursive, tree traversal

To learn tree traversal i implemented os.walk, tail-recursive and stack-based. Unfortunately Python doesn't support tail call optimization. How do i rewrite my ...
Mirzhan Irkegulov's user avatar
1 vote
3 answers
2k views

How to improve this functional python fast exponentiation routine?

I have the following python functions for exponentiation by squaring : ...
Cris Stringfellow's user avatar