From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 225ADC4332F for ; Mon, 17 Oct 2022 16:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229622AbiJQQzw (ORCPT ); Mon, 17 Oct 2022 12:55:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229801AbiJQQzv (ORCPT ); Mon, 17 Oct 2022 12:55:51 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 440245F7E9 for ; Mon, 17 Oct 2022 09:55:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666025750; x=1697561750; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=b4xrKAS2Wbd8B+088D/j5yUrr6OL+f0p8DHhMISKdGI=; b=hT9hvshP+PqoTGwhZW3TWgxecPWydSnRnNBYaas2tUBQylcx+zqs1wgT v2WrDW5801YCso5SNyQ6j5jf1UO8//Vpr3my24+vaUZhrgvmyUag47O6G ZLeeuaLJCMtFsyuEdX/tWDmCTHASVXcRGz3EDk0ZzWyTMGi7enI17U6R/ 2JoESWJLJLQncYp+0omqm1kg3lxIe9iQF6TJ3RtcQf0NwBjWrtXriXmai w31EXxdULPn5D+phdK6mSNmGbreDL9D1JCdos22uBychgG1WHij8m3MVT b+WfA5dUPlm10dOKsms6sTx3hdvNMia6PhvenhL6n8kzykxG3CBznV4DZ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="285579004" X-IronPort-AV: E=Sophos;i="5.95,192,1661842800"; d="scan'208";a="285579004" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2022 09:55:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="579442464" X-IronPort-AV: E=Sophos;i="5.95,192,1661842800"; d="scan'208";a="579442464" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003.jf.intel.com with ESMTP; 17 Oct 2022 09:55:42 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1okTOv-008vgb-1O; Mon, 17 Oct 2022 19:55:41 +0300 Date: Mon, 17 Oct 2022 19:55:41 +0300 From: Andy Shevchenko To: Kent Gibson Cc: Bartosz Golaszewski , Linus Walleij , Viresh Kumar , linux-gpio@vger.kernel.org Subject: Re: [libgpiod v2][PATCH v3 2/4] bindings: python: add examples Message-ID: References: <20221007145521.329614-3-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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. > Is that clearer? -- With Best Regards, Andy Shevchenko