4 ms·
This and the parent are mistaking the "how" all([]) is True for the why. The code is the "how", but it doesn't just exist. It could just as easily end in ret
by cpgxiii 3y ago
This and the parent are mistaking the "how" all([]) is True for the why. The code is the "how", but it doesn't just exist. It could just as easily end in
return len(L) > 0
instead, which would obviously have different behavior. The code is the embodiment of a particular design, the "why", which has a more complex history.
- ajross 3y agoThere's no treatment about any "complex history of the design of all()" though. The article is a bunch of nattering about philosophical semantics. And I'm saying that's just plain dumb. This is an engineering discipline. If there's a "why", then the author of the code is the resource, not (sigh) philosophers. Go ask Guido, or check the commit messages. Don't ask Aristotle, he can't hack. And the proof (that's right, proof) that I'm right is this: imagine Guido (or whoever) had indeed chosen the opposite convention for all(). It's easy to imagine. And it's equally easy to imagine people getting confused about it and asking about it. And you could reply with exactly this same article trying to explain the "why" behind it as part of two traditions of philosophy. That's right: the same words explain the opposite convention too. That's not an explanation for "why", is it? This whole discussion is QUITE LITERALLY providing zero insight into the question you're imagining it's answering! It's like asking someone "Why did you paint your house blue?", and them answering "Well, you see, I could have painted it blue, or red."
- empath75 3y ago"All" as the way it is _because_ it's an implementation of the following logical statement: For all x in X, P(x) It's not arbitrary, and understanding formal logic and the history of formal logic is a good basis for understanding a great many things in computer science.
- ajross 3y agoAnd I sigh for a third time. This is emphatically not about "formal logic", it's philosophy. If you want to argue from programming language type theory about the best/right/proper/whatever way to implement set theoretic predicates in python, I'm here for it. If you want to do it by citing Aristotle, my eyes start rolling.