all() is slow?

Chris Angelico rosuav at gmail.com
Tue Nov 8 20:19:42 EST 2011


On Wed, Nov 9, 2011 at 11:44 AM, Devin Jeanpierre
<jeanpierreda at gmail.com> wrote:
> Clearly what we need is a modern hygienic macro system to avoid this exec mess!
>
> defmacro defall(name, cond):
>    def name(lst):
>        for a in lst:
>            if not cond:
>                return False
>        return True

#define defall(name,cond) def name(lst): \
    for a in lst: \
        if not cond: return False \
    return True

gcc -E myprog.pyi -o myprog.py

There's no code you can't make more opaque using the C preprocessor.

Python doesn't have inline functions? Ha! In your FACE, evil Python
development cabal! You can't tell ME what I can't do!

ChrisA
PS. Don't try this at home. We have years of experience with bad code.
Don't write code like this unless you have a life insurance policy
that covers angry mobs.



More information about the Python-list mailing list