You can use dir(module) to see all available methods/attributes. Also check out PyDocs.

Answer from camflan on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_func_all.asp
Python all() Function
Remove List Duplicates Reverse ... Certificate Python Training ... The all() function returns True if all items in an iterable are true, otherwise it returns False....
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ library โ€บ functions.html
Built-in Functions โ€” Python 3.14.3 documentation
3 weeks ago - The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order.,,,, Built-in Functions,,, A, abs(), aiter(), all(), a...
Discussions

Is there a list of every Python function out there?
That's because the ones you mention are methods of the str type, not builtin functions. You can find the methods of all standard types here . More on reddit.com
๐ŸŒ r/learnpython
9
8
February 12, 2023
How do Python's any and all functions work? - Stack Overflow
The confusion can be that "FOR ALL" and "FOR ANY" are synonyms in other contexts... en.wikipedia.org/wiki/List_of_logic_symbols 2017-01-26T09:10:16.997Z+00:00 ... I know this is old, but I thought it might be helpful to show what these functions look like in code. This really illustrates the logic, better than text or a table IMO. In reality they are implemented in C rather than pure Python... More on stackoverflow.com
๐ŸŒ stackoverflow.com
How does the "all" function in Python work? - Stack Overflow
I searched for understanding about the all function in Python, and I found this, according to here: all will return True only when all the elements are Truthy. But when I work with this function ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
How all() function actually works?
All function arguments are evaluated before the function is called. all stops when it finds the first False value in an iterable: >>> def yield_some_things(): ... print('yielding false') ... yield False ... print('yielding true') ... yield True ... print('some more true') ... yield True ... >>> all(yield_some_things()) yielding false False More on reddit.com
๐ŸŒ r/learnpython
10
11
July 14, 2017
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-all-function
Python - all() function - GeeksforGeeks
July 23, 2025 - # All elements of list are true l = [4, 5, 1] print(all(l)) # All elements of list are false l = [0, 0, False] print(all(l)) # Some elements of list are # true while others are false l = [1, 0, 6, 7, False] print(all(l)) # Empty List l = [] ...
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ built-in โ€บ all
Python all()
Become a certified Python programmer. Try Programiz PRO! ... The all() function returns True if all elements in the given iterable are truthy. If not, it returns False. ... Note: Truthy values include non-zero numbers, non-empty sequences, and True. Falsy values include 0, None, False, and empty sequences. ... The all() function works in a similar way for tuples and sets like lists...
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ is there a list of every python function out there?
r/learnpython on Reddit: Is there a list of every Python function out there?
February 12, 2023 -

I recently learnt that stuff like .strip(), .title(), exists, which got me interested to learn about all these little bonus gimmicks about Python that I could use in my everyday tasks or to improve functionality in my code.

As of now I know that https://docs.python.org/3/library/functions.html exists but there isn't the functions mentioned above within that list. Is there another list of all these functions including those mentioned out there? Thank you

๐ŸŒ
Software Testing Help
softwaretestinghelp.com โ€บ home โ€บ python โ€บ python list functions โ€“ tutorial with examples
Python List Functions - Tutorial With Examples
April 1, 2025 - Since the Python all() function takes in an iterable argument, if an empty list is passed as an argument, then it will return True.
Find elsewhere
๐ŸŒ
BeginnersBook
beginnersbook.com โ€บ 2019 โ€บ 03 โ€บ python-all-function
Python all() Function with examples
# all values of this list are true # non-zero values are considered true lis1 = [10, 5, 15, 77] print(all(lis1)) # all values are false # 0 is considered as false lis2 = [0, False, 0] print(all(lis2)) # one value is false, others are true lis3 = [10, 0, 40] print(all(lis3)) # one value is true, others are false lis4 = [0, 0, True] print(all(lis4)) # empty iterable - no elements lis5 = [] print(all(lis5))
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_ref_functions.asp
Python Built-in Functions
Remove List Duplicates Reverse a String Add Two Numbers ยท Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training ... Python has a set of built-in functions...
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ python_all_function.htm
Python all() Function
The Python all() function is a built-in function that returns True if all the elements of a given iterable, such as a list, tuple, set, or dictionary are truthy, and if any of the values is falsy, it returns False.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ How-to-list-all-functions-in-a-Python-module
How to list all functions in a Python module?
August 26, 2023 - # Importing getmembers and isfunction from inspect from inspect import getmembers, isfunction # Importing math module import math as mt # Printing all the functions in math module print(getmembers(mt), isfunction) The output lists all the functions present in the math module.
Top answer
1 of 11
442

You can roughly think of any and all as series of logical or and and operators, respectively.

any

any will return True when at least one of the elements is Truthy. Read about Truth Value Testing.

all

all will return True only when all the elements are Truthy.

Truth table

+-----------------------------------------+---------+---------+
|                                         |   any   |   all   |
+-----------------------------------------+---------+---------+
| All Truthy values                       |  True   |  True   |
+-----------------------------------------+---------+---------+
| All Falsy values                        |  False  |  False  |
+-----------------------------------------+---------+---------+
| One Truthy value (all others are Falsy) |  True   |  False  |
+-----------------------------------------+---------+---------+
| One Falsy value (all others are Truthy) |  True   |  False  |
+-----------------------------------------+---------+---------+
| Empty Iterable                          |  False  |  True   |
+-----------------------------------------+---------+---------+

Note 1: The empty iterable case is explained in the official documentation, like this

any

Return True if any element of the iterable is true. If the iterable is empty, return False

Since none of the elements are true, it returns False in this case.

all

Return True if all elements of the iterable are true (or if the iterable is empty).

Since none of the elements are false, it returns True in this case.


Note 2:

Another important thing to know about any and all is, it will short-circuit the execution, the moment they know the result. The advantage is, entire iterable need not be consumed. For example,

>>> multiples_of_6 = (not (i % 6) for i in range(1, 10))
>>> any(multiples_of_6)
True
>>> list(multiples_of_6)
[False, False, False]

Here, (not (i % 6) for i in range(1, 10)) is a generator expression which returns True if the current number within 1 and 9 is a multiple of 6. any iterates the multiples_of_6 and when it meets 6, it finds a Truthy value, so it immediately returns True, and rest of the multiples_of_6 is not iterated. That is what we see when we print list(multiples_of_6), the result of 7, 8 and 9.

This excellent thing is used very cleverly in this answer.


With this basic understanding, if we look at your code, you do

any(x) and not all(x)

which makes sure that, atleast one of the values is Truthy but not all of them. That is why it is returning [False, False, False]. If you really wanted to check if both the numbers are not the same,

print [x[0] != x[1] for x in zip(*d['Drd2'])]
2 of 11
58

How do Python's any and all functions work?

any and all take iterables and return True if any and all (respectively) of the elements are True.

>>> any([0, 0.0, False, (), '0']), all([1, 0.0001, True, (False,)])
(True, True)            #   ^^^-- truthy non-empty string
>>> any([0, 0.0, False, (), '']), all([1, 0.0001, True, (False,), {}])
(False, False)                                                #   ^^-- falsey

If the iterables are empty, any returns False, and all returns True.

>>> any([]), all([])
(False, True)

I was demonstrating all and any for students in class today. They were mostly confused about the return values for empty iterables. Explaining it this way caused a lot of lightbulbs to turn on.

Shortcutting behavior

They, any and all, both look for a condition that allows them to stop evaluating. The first examples I gave required them to evaluate the boolean for each element in the entire list.

(Note that list literal is not itself lazily evaluated - you could get that with an Iterator - but this is just for illustrative purposes.)

Here's a Python implementation of any and all:

def any(iterable):
    for i in iterable:
        if i:
            return True
    return False # for an empty iterable, any returns False!

def all(iterable):
    for i in iterable:
        if not i:
            return False
    return True  # for an empty iterable, all returns True!

Of course, the real implementations are written in C and are much more performant, but you could substitute the above and get the same results for the code in this (or any other) answer.

all

all checks for elements to be False (so it can return False), then it returns True if none of them were False.

>>> all([1, 2, 3, 4])                 # has to test to the end!
True
>>> all([0, 1, 2, 3, 4])              # 0 is False in a boolean context!
False  # ^--stops here!
>>> all([])
True   # gets to end, so True!

any

The way any works is that it checks for elements to be True (so it can return True), then it returnsFalseif none of them wereTrue`.

>>> any([0, 0.0, '', (), [], {}])     # has to test to the end!
False
>>> any([1, 0, 0.0, '', (), [], {}])  # 1 is True in a boolean context!
True   # ^--stops here!
>>> any([])
False   # gets to end, so False!

I think if you keep in mind the short-cutting behavior, you will intuitively understand how they work without having to reference a Truth Table.

Evidence of all and any shortcutting:

First, create a noisy_iterator:

def noisy_iterator(iterable):
    for i in iterable:
        print('yielding ' + repr(i))
        yield i

and now let's just iterate over the lists noisily, using our examples:

>>> all(noisy_iterator([1, 2, 3, 4]))
yielding 1
yielding 2
yielding 3
yielding 4
True
>>> all(noisy_iterator([0, 1, 2, 3, 4]))
yielding 0
False

We can see all stops on the first False boolean check.

And any stops on the first True boolean check:

>>> any(noisy_iterator([0, 0.0, '', (), [], {}]))
yielding 0
yielding 0.0
yielding ''
yielding ()
yielding []
yielding {}
False
>>> any(noisy_iterator([1, 0, 0.0, '', (), [], {}]))
yielding 1
True

The source

Let's look at the source to confirm the above.

Here's the source for any:

static PyObject *
builtin_any(PyObject *module, PyObject *iterable)
{
    PyObject *it, *item;
    PyObject *(*iternext)(PyObject *);
    int cmp;

    it = PyObject_GetIter(iterable);
    if (it == NULL)
        return NULL;
    iternext = *Py_TYPE(it)->tp_iternext;

    for (;;) {
        item = iternext(it);
        if (item == NULL)
            break;
        cmp = PyObject_IsTrue(item);
        Py_DECREF(item);
        if (cmp < 0) {
            Py_DECREF(it);
            return NULL;
        }
        if (cmp > 0) {
            Py_DECREF(it);
            Py_RETURN_TRUE;
        }
    }
    Py_DECREF(it);
    if (PyErr_Occurred()) {
        if (PyErr_ExceptionMatches(PyExc_StopIteration))
            PyErr_Clear();
        else
            return NULL;
    }
    Py_RETURN_FALSE;
}

And here's the source for all:

static PyObject *
builtin_all(PyObject *module, PyObject *iterable)
{
    PyObject *it, *item;
    PyObject *(*iternext)(PyObject *);
    int cmp;

    it = PyObject_GetIter(iterable);
    if (it == NULL)
        return NULL;
    iternext = *Py_TYPE(it)->tp_iternext;

    for (;;) {
        item = iternext(it);
        if (item == NULL)
            break;
        cmp = PyObject_IsTrue(item);
        Py_DECREF(item);
        if (cmp < 0) {
            Py_DECREF(it);
            return NULL;
        }
        if (cmp == 0) {
            Py_DECREF(it);
            Py_RETURN_FALSE;
        }
    }
    Py_DECREF(it);
    if (PyErr_Occurred()) {
        if (PyErr_ExceptionMatches(PyExc_StopIteration))
            PyErr_Clear();
        else
            return NULL;
    }
    Py_RETURN_TRUE;
}
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ any-all-in-python
Any All in Python - GeeksforGeeks
July 23, 2025 - In this another example, we are seeing of all numbers in list1 are odd and by using all() function, if they are odd then we will return True otherwise False. ... # Illustration of 'all' function in python 3 # Take two lists list1=[] list2=[] # All numbers in list1 are in form: 4*i-3 for i in range(1,21): list1.append(4*i-3) # list2 stores info of odd numbers in list1 for i in range(0,20): list2.append(list1[i]%2==1) print('See whether all numbers in list1 are odd =>') print(all(list2))
๐ŸŒ
HubSpot
blog.hubspot.com โ€บ home โ€บ the hubspot website blog
Python List Functions: 18 Definitions & Examples
March 20, 2023 - HubSpotโ€™s Website Blog covers everything you need to know to build maintain your companyโ€™s website.
๐ŸŒ
Python Morsels
pythonmorsels.com โ€บ any-and-all
Python's any() and all() functions - Python Morsels
March 29, 2023 - >>> all([True, False, True, True, False]) False >>> all([True, True, True, True, True]) True >>> all(['Python', 'is', 'neat']) True >>> all(['', 'Python', 'is', 'neat']) False ... The any and all functions accept an iterable and check the truthiness of each item in that iterable. These functions are typically used with iterables of boolean values. We could re-implement our ratings_valid function by building up a list of boolean values and then passing those values to the any function:
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-any-and-all-functions-explained-with-examples
Python any() and all() Functions โ€“ Explained with Examples
August 10, 2021 - When coding in Python, have you ever had to check if any item or all items in an iterable evaluate to True? The next time you need to do so, be sure to use the nifty functions any() and all(). In this tutorial, we'll learn about Python's any() and al...
๐ŸŒ
W3docs
w3docs.com โ€บ python
How to list all functions in a module?
To list all functions in a module, you can use the dir() function to get a list of all the names defined in the module, and then use the inspect module to check if each name is a function.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_ref_list.asp
Python List/Array Methods
Python Functions Python Arguments Python *args / **kwargs Python Scope Python Decorators Python Lambda Python Recursion Python Generators Code Challenge Python Range
๐ŸŒ
Initial Commit
initialcommit.com โ€บ blog โ€บ python-all-function
Python all() Function
In the next two examples, the lists have at least one False value, so the all() function returns False. The last example is slightly confusing - it returns True with an empty list since there are no values in the list that are False. In the previous section, we only used the boolean values True and False. But the iterable can contain any data types, such as a string, integer, float, or even other data structures. So what classifies a data type as True or False? Let's use Python's bool() built-in function to determine which boolean value is given to certain common objects.