if not a:
    print("List is empty")

Using the implicit booleanness of the empty list is quite Pythonic.

Answer from Patrick on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-check-if-list-empty-not
Check if a list is empty or not in Python - GeeksforGeeks
October 24, 2024 - We can also use len() function to see if a list is empty by checking if its length is zero. ... Explanation: len(a) returns 0 for an empty list. Lists can be directly evaluated in conditions. Python considers an empty list as False.
Discussions

How do I check if this list is "empty"?
Well there are a few ways you could deal with this. First would be to check if userInput is an empty string before converting it to a list. Another possibility would be to filter the list to remove all empty strings, eg via a list comprehension. Or you could do the filtering inside the loop you already have that converts to integers. Or, again inside that loop, you could use a counter variable to keep track of how many integers you've converted, and print an error afterwards if it's 0. And so on. The main thing here is that you should get away from thinking about how to code something, but first work out what the steps should be, and only then code it. More on reddit.com
🌐 r/learnpython
7
1
December 8, 2022
What's the most pythonic way of checking if variable is None or empty string ""?
Both None and "" are falsy values so simply if not variable: will cover both those cases. This doesn't explicitly check for those values but if you're just checking for something not being set this is probably the way to go. More on reddit.com
🌐 r/learnpython
9
4
July 6, 2021
return None or not to return None

Might not be exactly on topic but I wish more people would code their functions to NOT return None and instead return expected type.

BeautifulSoup is the biggest perpetrator of this. Whenever you parse the tree/soup you'll either get a list of results or a single result, now if no results are found instead of getting an empty list you get None returned, which in turn requires you to make checks on every single lookup which really messes up your code up and makes everything look ridiculous.

switched to lxml/xpath and never looked back.

More on reddit.com
🌐 r/Python
64
30
March 31, 2015
None, False, 0 or [] as returned values
Ummm ... if a function returns a collection of rows matching a criteria, and finds none that match, should it not return an empty collection? More on reddit.com
🌐 r/Python
69
34
July 5, 2012
🌐
Python Morsels
pythonmorsels.com › checking-for-an-empty-list-in-python
Checking for an empty list in Python - Python Morsels
July 18, 2026 - One way to check whether a list is empty is to check the length of that list. If the length is 0, the list must be empty: >>> numbers = [] >>> if len(numbers) == 0: ... print("The list is empty.") ... The list is empty.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-check-if-a-list-is-empty-in-python
Python isEmpty() equivalent – How to Check if a List is Empty in Python
April 19, 2023 - In the code above, we used an if statement and the not operator to check if the people_list was empty. You can use the len() function in Python to return the number of elements in a data structure.
🌐
Flexiple
flexiple.com › python › check-if-list-is-empty-python
How to check if a list is empty in Python? - Flexiple Tutorials
Empty lists are considered False ... you can use to check if a list is empty are placing it inside an if statement, using the len() methods, or comparing it with an empty list....
🌐
Built In
builtin.com › articles › python-check-if-list-is-empty
Python Check if a List Is Empty: A Guide | Built In
The most common way to test if a list is empty in Python is to use the truth value testing method with the not operator. The len() function is best if you are working with different data structures, while the == operator makes your code easier ...
🌐
Reddit
reddit.com › r/learnpython › how do i check if this list is "empty"?
r/learnpython on Reddit: How do I check if this list is "empty"?
December 8, 2022 -

I'm completely stumped on a computer science assignment because our lecturer has given us zero information. We're supposed to have the user input a list and check if the list is in decreasing order and print a suitable message if it is. That part works fine. However, if the list is "empty" (I'll explain the quotations in a second) then it should print the list is empty.

The problem is that, according to our brief we're supposed to use .split(",") in order to allow the user to separate their numbers with commas. The problem lies in the fact that even if a user hits enter without inputting anything, the list is still '1' long with just an empty string. I've been scouring the web to find out how to check if a list is empty. But all the tutorials have so far just been in relation to actually empty lists (as in, list = []). One did use the all() function to check that all items in the list were strings, which did work and let me print that the list is empty, but broke the original function. Could someone please help me I'm tearing my hair out with this.

--

def checkOrder():

# checks, etc.

integer_list = []

listLength = len(integer_list)

increasing = 0

decreasing = 0

singleValue = 0

# Converting inputted numbers into a split list

userInput = input("Please enter your numbers seperated by a comma (,):")

inputtedStrings = userInput.split(",")

for number in inputtedStrings:

inputtedIntegers = int(number)

integer_list.append(inputtedIntegers)

# Enumerating list

for i, val in enumerate(integer_list[:-1]):

if val <= integer_list[i+1]:

increasing = 1

elif val >= integer_list[i+1]:

decreasing = 1

# Check for a single value

if len(integer_list) == 1:

singleValue = 1

if len(integer_list) == 1 and

print("The list is empty.")

if increasing == 1:

print("The numbers are in increasing order.")

elif decreasing == 1 or singleValue == 1:

print("The numbers are in decreasing order.")

checkOrder()

--

Find elsewhere
🌐
Curict
en.curict.com › item › 9a › 9a5983d.html
Checking if a Python list is empty - curict.com
# Checking for an empty list considering None if emptyList is None: print('It is None') elif not emptyList: print('The list is empty')
🌐
iO Flood
ioflood.com › blog › python-check-if-list-is-empty
Learn Python: How To Check If a List Is Empty?
June 27, 2024 - The if statement first checks if my_list is None, and if it’s not, it checks if my_list is empty. If either condition is True, it prints ‘Variable is None or list is empty’. While using the not operator is a common approach, Python offers other ways to check if a list is empty.
🌐
Sentry
sentry.io › sentry answers › python › check if a list is empty in python
Python: Check if a List Is Empty (Pythonic Way) | Sentry
2 weeks ago - The Python style guide, PEP-8, recommends checking whether a list (or other sequence) is False to determine that it is empty. For example: empty_list = [] if not empty_list: print("The list is empty.")
🌐
Python Pool
pythonpool.com › home › how to › check if a list is empty in python: if not, len(), and numpy
Check if a List Is Empty in Python: if not, len(), and NumPy
July 13, 2026 - Quick answer: Use if not items: for an ordinary Python list. Use if items: for the non-empty case, len(items) == 0 when the count is part of the logic, and array.size == 0 for a NumPy array. Keep None as a separate input state.
🌐
TutorialsPoint
tutorialspoint.com › How-to-check-if-a-list-is-empty-in-Python
How to check if a list is empty in Python?
April 23, 2025 - import numpy as np # Empty list ... print('Empty list') else: print('List is not empty') ... The not operator is the most Pythonic and efficient way to check for empty lists....
🌐
Stack Abuse
stackabuse.com › how-to-check-if-list-is-empty-in-python
How to Check if List is Empty in Python
February 20, 2023 - Although this method looks simple, ... those who are new to python or coding itself usually consider it more intuitive: if len(py_list) == 0: print('List is empty') else: print('List not empty')...
🌐
Programiz
programiz.com › python-programming › examples › check-empty-list
Python Program to Check If a List is Empty
In this example, length of list is used to check if there is any element in the list. If the length of a list is 0, then the list is empty. To learn more, visit Python len().
🌐
Mimo
mimo.org › tutorials › python › how-to-check-if-a-list-is-empty-in-python
How to Check if a List is Empty in Python
Use if items: for the standard empty-list check. Use len(items) == 0 when you need a numeric count check. Guard before indexing with items[0] or items[-1]. You usually don’t need a check before for item in items. Decide how you want to handle None if it can appear instead of a list.
🌐
How to Use Linux
howtouselinux.com › home › 3 ways to check if a list is empty in python
3 Ways to Check if a List is Empty in Python - howtouselinux
October 9, 2025 - To check if Python List is empty, we can write a condition if the length of the list is zero or not; or we can directly use the list reference along with not operator as a condition in if statement.
🌐
Python Guides
pythonguides.com › python-check-if-list-is-empty4-methods
Python Check If List is Empty[4 Methods] - Python Guides
October 14, 2025 - The not operator is one of the most Pythonic ways to check if a list is empty. It’s clean, readable, and fast. When you use not on a list, Python automatically checks its truth value. An empty list evaluates to False, while a non-empty list evaluates to True.
🌐
Thinkincode
thinkincode.net › python › python-check-if-list-is-empty
Python - how to check if a list is empty | ThinkInCode
February 15, 2024 - Add an addtional check to the if clause - if my_list == [] or my_list is None · You can use the bool() function to convert the list to a boolean value, bool(mylist) will be False if the list is empty
🌐
AskPython
askpython.com › python › list › check-if-list-is-empty
Check if a List is Empty - 3 Easy Methods - AskPython
July 17, 2020 - Python Conditional if statement can be used to check whether the list is empty or not as shown below–