[oe] Conditional Expressions in Python

Khem Raj raj.khem at gmail.com
Sun Sep 9 20:28:31 UTC 2007


yes it looks more readable too.

On 9/9/07, Dr. Michael Lauer <mickey at vanille-media.de> wrote:
> Guys,
>
> I vote for rewriting our conditional expressions hack in .bb files:
>
> DEPENDS = "${@['virtual/${TARGET_PREFIX}gcc-initial','virtual/${TARGET_PREFIX}gcc']['nptl' in '${GLIBC_ADDONS}']}"
>
> Since Python 2.5, this can be written as:
>
> DEPENDS = "${@'virtual/${TARGET_PREFIX}gcc' if 'nptl' in '${GLIBC_ADDONS}' else 'virtual/${TARGET_PREFIX}gcc-initial'}
>
> which parses faster and is much more clear and concise. IIRC the
> resulting bytecode is also faster since there is no need to construct,
> access, and destroy temporary lists.
>
> Regards,
>
> :M:
> --
> Michael 'Mickey' Lauer | IT-Freelancer | http://www.vanille-media.de
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>




More information about the Openembedded-devel mailing list