This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2006年02月15日 20:26 by paulcannon, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg54722 - (view) | Author: paul cannon (paulcannon) | Date: 2006年02月15日 20:26 | |
Just a couple very simple "shortcutting" functions that I find myself needing quite frequently. "reduce(operator.or_, foo, False)" is all right, but potentially does a lot more work. def any(i): """Returns true if any element from i is true.""" for element in i: if i: return True return False all() would also be nice: def all(i): """Returns true if all elements from i are true.""" for element in i: if not i: return False return True ..although it /could/ simply be built on any() as "not any(imap(operator.not_, i))". |
|||
| msg54723 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2006年02月15日 20:44 | |
Logged In: YES user_id=1188172 These two happen to become builtins in 2.5. |
|||
| msg54724 - (view) | Author: paul cannon (paulcannon) | Date: 2006年02月15日 21:17 | |
Logged In: YES user_id=222090 I love you people. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:15 | admin | set | github: 42907 |
| 2006年02月15日 20:26:42 | paulcannon | create | |