On Mon, Oct 17, 2022 at 6:57 PM Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote: > > On Mon, Oct 17, 2022 at 07:55:41PM +0300, Andy Shevchenko wrote: > > On Tue, Oct 18, 2022 at 12:20:18AM +0800, Kent Gibson wrote: > > > On Tue, Oct 18, 2022 at 12:09:10AM +0800, Kent Gibson wrote: > > ... > > > > Oh, btw, the parser fn version would be something like: > > > > > > def parse_value(arg): > > > (x,y) = arg.split("=") > > > return (x, Value(int(y))) > > > > Not a lisp, no need for too many parentheses. Also, we could use splices: > > > > eqidx = arg.index('=') > > return arg[:eqidx], Value(int(arg[eqidx + 1:])) > > > > or with split() > > > > l, v = arg.split('=') > > return l, Value(int(v)) > > > > > lvs = [ parse_value(arg) for arg in sys.argv[2:] > > > > Dunno why you put spaces inside outer [], but okay. > > and this actually can be directly put to the dict constructor: > > values = OrderedDict(parse_value(arg) for arg in sys.argv[2:]) > > This looks short enough and readable. > Let's stop bikeshedding, I'll move on to stuff that really matters now. :) Bartosz