Twice in the log links to nodes branch I had to work around tuples as stand-ins for light weight types.
recursiveUNLFind() uses `return found, maxdepth, maxp`. g.es() uses `app.logWaiting.append((s, color, newline))` This is a problem because it's hard to extend without modifying every case where these 'types' are processed. There are several alternatives, all with pluses and minuses. dict() is an obvious one, but because of Python's verbose dict syntax (foo['bar'] not foo.bar) it makes code harder to read - I actually think this might be why the habit and problem arise in the first place. namedtuple helps a bit, as long as use foo.bar to access its elements, but I find it being readonly inconvenient, and they maintain the temptation to use assumptions about order / length to process them, where no such temptation exists with the bunch / dict based solutions... Then there are all the `bunch` type solutions, class Bunch: pass a = Bunch() a.thing = 42 or a = type('bunch', (), {}) a.thing = 42 this form is nice because it's concise, and can be inited with a dict. Then there are lot enhanced dict() replacements. https://github.com/mewwts/addict might be the best. It allows a = Dict() a.point.x = 42 a.point.y = -11.1 Leo has a g.Bunch class that's somewhere on the bunch / dict continuum. `addict` supports JSON well, but other than that, not sure about g.Bunch. I guess my question is what have others seen in tutorials / books / blogs? Using tuples this way seems common in lots of Python code, not just Leo's codebase. Google throws up https://docs.quantifiedcode.com/python-anti-patterns/readability/not_using_named_tuples_when_returning_more_than_one_value.html but I'd expect to have seen more of this kind of comment than I have. Cheers -Terry -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.