All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Lock <josh@linux.intel.com>
To: Paul Eggleton <paul.eggleton@linux.intel.com>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [RFC PATCH 1/2] bitbake: track skipped packages
Date: Fri, 03 Jun 2011 09:38:06 -0700	[thread overview]
Message-ID: <1307119092.2042.13.camel@scimitar> (raw)
In-Reply-To: <201106031051.12212.paul.eggleton@linux.intel.com>

On Fri, 2011-06-03 at 10:51 +0100, Paul Eggleton wrote:
> On Thursday 02 June 2011 21:01:52 Joshua Lock wrote:
> > This doesn't seem very Pythonic. I think you should just be able to do:
> > bb.data.setVar("__SKIPPED", e, d)
> > or possibly:
> > bb.data.setVar("__SKIPPED", str(e), d)
> 
> Why is accessing args[0] un-Pythonic? As I understand it, args is provided 
> (and documented) as the way to get access to the arguments to the exception, 
> and the first argument is being used by us for the reason in the case of 
> SkipPackage. At the moment e or str(e) will accomplish the same thing, but 
> were we to add another argument then it seems to me that the results would be 
> different.
> 
> Now I'm not a Python expert by any stretch of the imagination but I'd like to 
> understand the reason why this usage might be considered undesirable.
> 

Caveat: also not a Python expert!

I raised the comment as it's a pattern I've not seen often in Python
code I've interacted with. Therefore it stood out/didn't look quite
right.

You are correct that if another argument were added the results would be
different: "If str() or unicode() is called on an instance of this
class, the representation of the argument(s) to the instance are
returned, or the empty string when there were no arguments."
http://docs.python.org/library/exceptions.htm

Happy to retract my nit picking,
Joshua
-- 
Joshua Lock
        Yocto Build System Monkey
        Intel Open Source Technology Centre




  reply	other threads:[~2011-06-03 16:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01 17:26 [RFC PATCH 0/2] skipped recipe handling Paul Eggleton
2011-06-01 17:26 ` [RFC PATCH 1/2] bitbake: track skipped packages Paul Eggleton
2011-06-02 20:01   ` Joshua Lock
2011-06-03  9:51     ` Paul Eggleton
2011-06-03 16:38       ` Joshua Lock [this message]
2011-06-01 17:26 ` [RFC PATCH 2/2] bitbake-layers: handle skipped recipes Paul Eggleton
2011-06-02 20:03   ` Joshua Lock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1307119092.2042.13.camel@scimitar \
    --to=josh@linux.intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=paul.eggleton@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.