4 ms·
That's an awkward way to speak. "Take each of my gizmos, then put it in the gizmo box" for gizmo in gizmos: gizmo.put_in_box() vs "Put all my gizmos in
by mekkkkkk 5y ago
That's an awkward way to speak.
"Take each of my gizmos, then put it in the gizmo box"
for gizmo in gizmos: gizmo.put_in_box()
vs
"Put all my gizmos in the gizmo box"
gizmos.'put_in_box()
- hinkley 5y agoOr “paint all my gizmos red”.
- RHSeeger 5y agoYour first statement is unambiguous. Your second sentence is ambiguous. It could mean 1. Put all of my gizmos in a single gizmo box, together, OR 2. Put each of my gizmos in its own gizmo box
- mekkkkkk 5y agoAre you talking about the pseudo code or the readable sentences? I hope my point comes across even if there's some linguistic nuance I'm missing.
- RHSeeger 5y agoI'm talking about the readable sentences. The one you labelled as "an awkward way to speak" was unambiguous. The phrasing it seems you preferred was ambiguous. Personally, if I have to write the sentence down and the consumer of the sentence can't ask questions to clarify, I prefer the unambiguous wording. Ie, say exactly what you mean or you may not get what you want. > A wife asks her husband, a software engineer, “Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6!” A short time later the husband comes back with 6 cartons of milk. The wife asks him, “Why the hell did you buy 6 cartons of milk?” He replied, “They had eggs.”
- jbluepolarbear 5y agoThe second code doesn’t put all the gizmos in the gizmo box. That’s your intent, but not the reality. All that syntax says is apply function to all elements. It is syntactic sugar for the code you put above; it’s a for each loop.
- mekkkkkk 5y agoWell, the argument is about expressing intent, so I guess we agree.