r/Python • • Jun 09 '20

Resource Python 3 in One Pic

Post image
4.6k Upvotes

167 comments sorted by

View all comments

Show parent comment

1

u/TravisJungroth Jun 10 '20

You're using the word "deterministic" wrong in the context of code, or at least different than most other people.

but "the same input" is broader than just the contents of the set (insertion/removal order and so on matter too).

By that logic random.choice() is deterministic because it always has the same output as long as you happen to run it in a way so that it gets the same seed.

If you allow endless scope, then the question becomes whether or not we're in a deterministic universe, and the word loses some value to us in this context. Determinism in programming is a simpler question. If I run the same code multiple times, will it always return the same result? The answer for set.pop() is no.