Re: [Python-ideas] Python-ideas Digest, Vol 138, Issue 95

Concerning my previous email, Yes, my mistake. I'd forgotten (ironically) that the whole point is that it's an expression itself. So
Consequently, my example is invalid. A better example would have been where one needs to access more than one attribute of the expression while (node.x, node.y) > (5.0, 5.0) given node = get_neighbours(node): pass This wouldn't be so easy to do without writing a lambda, or conditional break. Again, the example is completely arbitrary, simply there to indicate that moving the assignment out of the expression itself gives more scope for use. Hence, by superset, I meant that all cases using ":=" can be expressed with given, but not visa-versa. ---
Clearly the objectively best choice is "<-". I'm convinced ;)
Examples: https://gist.github.com/agoose77/7ac98e74c3b7f1892789575c8cd50536 If i'm refactoring this kind of code, or new to the module and attempting to unpick what is happening, I would argue that the latter example presents me with what I most care about up-front (the condition) and maybe care about (the implementation) second. Furthermore, the assignment is very obvious, which I think is quite important. I don't think that the ':=' approach is entirely cryptic, of course, I can read it. But I find the clarity in putting the expression before the assignment to be worthwhile. --- the term, but here I think it's appropriate. It doesn't quite fit the exact definition, I grant you, but arguing about character cost seems premature in the question of whether one should care about character cost (within reason). ---
Cheers, Angus
participants (1)
-
Angus Hollands