Python Forum
suggested change for all() and any()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
suggested change for all() and any()
#1
the all() and any() functions test all the elements of the given iterator (list, etc) to see if all/any of those elements are True. my suggested change is to support one or more optional additional arguments. then the logic is to test if all/any of the elements of the iterator given in the first argument is equal to any of the remaining arguments. if there is only one argument, the original logic is performed. if two arguments are given, where the 2nd argument is True, theses functions act similar to the way if only one argument is given, but the test is for exactly the value True. IOW, the default for the remaining arguments, if none are, given, is the generalized test for truthfulness (the original logic).

discussion?

* Skaperen ducks his head!
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
suggested change for all() and any() - by Skaperen - Aug-05-2018, 11:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  suggested improvements. Skaperen 0 1,435 Mar-27-2020, 12:06 AM
Last Post: Skaperen
  want suggested module for e-mail parsing Skaperen 0 1,555 Jul-26-2019, 08:52 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020