[bitbake-devel] [RFC PATCH 1/2] bitbake: track skipped packages

Joshua Lock josh at linux.intel.com
Fri Jun 3 16:38:06 UTC 2011


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





More information about the bitbake-devel mailing list