On Mon, Oct 17, 2022 at 05:53:52PM +0200, Bartosz Golaszewski wrote: > On Mon, Oct 17, 2022 at 4:19 PM Andy Shevchenko > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote: ... > How about this? > > lvs = list( > map( > lambda val: [val[0], Value(int(val[1]))], > [arg.split("=") for arg in sys.argv[2:]], > ) > ) Yeah, this looks ugly... So initial variant with two lines looks to me like this: lvs = [arg.split("=") for arg in sys.argv[2:]] # btw, needs handling 2 exceptions values = dict((x, Value(int(y))) for (x,y) in lvs) # needs to handle an exception # Perhaps you need ordered dict? lines = values.keys() > lines = [x[0] for x in lvs] > values = dict(lvs) > It's so much less readable but at least it's pythonic, look at those > lambdas and comprehension lists and even a map! :) -- With Best Regards, Andy Shevchenko