3 ms·
What is the alternative besides chaining, devise a new variable name for every operation? I understand that daisy chaining can be error prone, but the alternati
by prestonh 8y ago
What is the alternative besides chaining, devise a new variable name for every operation? I understand that daisy chaining can be error prone, but the alternative is so difficult to maintain in long chains.
- jacobolus 8y agoIf the object is modified in place (as it seems to be in this case), then the “pythonic” approach is: img = ... img.resize(...) img.blur(....) img.hflip()
- Sileni 8y agoThe other commenter pointed out the "inplace" version, but in the event I can't get away with that (or don't want to for some reason), I tend to throw in some numbering scheme on my original variable, and at the end replace the original variable or move to a "result_object" sort of name. I think this is an edge case that is always going to feel inelegant, so whatever makes it easiest to load into my head wins out.