There is no such thing as "returning nothing" in Python. Every function returns some value (unless it raises an exception). If no explicit return statement is used, Python treats it as returning None.

So, you need to think about what is most appropriate for your function. Either you should return None (or some other sentinel value) and add appropriate logic to your calling code to detect this, or you should raise an exception (which the calling code can catch, if it wants to).

Answer from Blckknght on Stack Overflow
🌐
Reddit
reddit.com › r/learnpython › how to have python return nothing instead of none?
r/learnpython on Reddit: How to have Python return nothing instead of None?
February 3, 2022 -

Python and I are NOT getting along today.

I have the script below, which takes arguments like username and fromdate and passes it into the appropriate place in the URL (the link variable). Now, if the user just inputs username and doesn't input fromdate, Python will return None instead of nothing. Why do you do this, Python!? I never asked you to!

How can I avoid this monstrosity?

Command

main.py  -u jacksfilms

Script

import requests, re, argparse

parser = argparse.ArgumentParser()
parser.add_argument('-u','--username', required=False)
parser.add_argument('-from','--fromdate', required=False)
parser.add_argument('-to','--todate', required=False)
args = vars(parser.parse_args())
username = args['username']
fromdate = args['fromdate']
todate = args['todate']

link = "https://web.archive.org/cdx/search/cdx?url=twitter.com/{}/status&matchType=prefix&from={}&to={}".format(username,fromdate,todate)
data = []

c = requests.get(link).text
urls = re.findall(r'https?://[^\s<>"]+[|www\.^\s<>"]+', c)

for i, url in enumerate (urls):
    data.append(f"{i}: {url}\n")
    
print(data)
Discussions

How to not return None? (Arithmetic Formatter)
I’ve managed to get the function to work perfectly when I submit a list via Print(). My problem is when I’m running the actual test_module.py The problem seems to be with my return statements. Initially, I set the entire thing up so that I return a print statement of the errors. More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
1
0
February 8, 2021
Why does the my code return none!? I’m a noob so I don’t know whether the question is overtly stupid or what😃
This returns none. Ideal behind program is to convert Celsius to Fahrenheit using Fahrenheit = (9/5) * celsius + 32 But when I write return (9/5) * c + 32 it gives the desired result Just curious on the difference between print ((9/5) * c + 32) and return More on discuss.python.org
🌐 discuss.python.org
0
July 25, 2021
Deprecate bare return statements - Ideas - Discussions on Python.org
FWIW “bare returns” (i.e. return vs return None ) I find are unintuitive as well. I think much of what is being said about bare except can also be said about “bare returns”. And while I feel PEP-8 does make an attempt to clarify this: “”" Be consistent in return statements. More on discuss.python.org
🌐 discuss.python.org
0
August 9, 2019
How to have Python return nothing instead of None?
None is nothing. That's the "nothing" value. More on reddit.com
🌐 r/learnpython
14
12
February 3, 2022
🌐
Python.org
discuss.python.org › python help
Why does one version of my function return None, while the other works fine? - Python Help - Discussions on Python.org
October 26, 2023 - Inspired by the pipeline operator (|>) in other languages, I tried to implement a function to imitate it. When I use reduce to implement it, it results in None somewhere along the way, but another one using loops works just fine. from functools import partial, reduce from pprint import pprint def pipeline(data, *funcs): res = data for func in funcs: res = func(res) return res def pipeline_v2(data, *funcs): reduce(lambda arg, func: func(arg), funcs, data) def main() ->...
🌐
Finxter
blog.finxter.com › home › learn python blog › python return nothing/null/none/nan from function
Python Return Nothing/Null/None/NaN From Function - Be on the Right Side of Change
August 1, 2023 - To return an empty value or “nothing” from a Python function, you can use the return statement followed by the keyword None.
🌐
Julianhysi
julianhysi.com › post › 4
Julian's Blog - Bare return vs return None vs no return
April 17, 2021 - A great example are methods which ... isn't supposed to return anything for the actual input arguments ? Every function in Python which does not hit a return statement, will implicitly return None....
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-return-null-in-python
How to return null in Python ? - GeeksforGeeks
July 23, 2025 - def my_function(): return None # Call the function and store #the returned value in the variable 'result' result = my_function() print(result) ... In Python, None is used to represent a null value or the absence of a result.
Find elsewhere
🌐
Quora
quora.com › In-Python-what-does-return-None-mean-if-inside-a-function-we-use-return-without-any-value
In Python, what does return None mean if inside a function we use return without any value? - Quora
Answer (1 of 4): You’re correct; just a simple [code ]return[/code] statement without a value will return [code ]None[/code] implicitly. The reason why this happens is because Python has no concept of void. In C, if you wanted to not return ...
🌐
Designcise
designcise.com › web › tutorial › how-to-return-nothing-or-null-from-a-python-function
How to Return Nothing/Null From a Python Function? - Designcise
November 13, 2022 - In Python, there's no "null" keyword. However, you can use the "None" keyword instead, which implies absence of value, null or "nothing". It can be returned from a function in any of the following ways: By returning None explicitly; By returning ...
🌐
Better Programming
betterprogramming.pub › please-stop-returning-none-from-python-functions-ff98e492b4b0
Stop Returning None From Python Functions | by Imran Ali
August 10, 2023 - When the numerator is 0, the function would return 0, which is expected but look at what happens in…
🌐
LabEx
labex.io › tutorials › python-how-to-check-if-a-function-returns-none-in-python-559522
How to Check If a Function Returns None in Python | LabEx
It's important to use the is operator to check if a value is None because None is a singleton object in Python. This means that there is only one instance of None in the entire program. Using the == operator might not always work correctly because it compares the values of the objects, not the objects themselves. In this lab, you learned about function return values in Python.
🌐
Real Python
realpython.com › python-return-statement
The Python return Statement: Usage and Best Practices – Real Python
June 14, 2024 - Now, suppose you’re getting deeper into Python and you’re starting to write your first script. You open a text editor and type the following code: ... add() takes two numbers, adds them, and returns the result. On line 5, you call add() to sum 2 plus 2. Since you’re still learning the difference between returning and printing a value, you might expect your script to print 4 to the screen. However, that’s not what happens, and you get nothing on your screen.
🌐
Codecademy
codecademy.com › forum_questions › 53e4fb41548c350a760021ce
Why does the return function in python always return none no matter what I have it return? | Codecademy
In this case you’ve made some functions but are you calling them ? and the answer is No. I read in another post in this forum that Python uses None to represent nothingness and I would like to think of this as a case where the program returns nothing and hence the None.
Top answer
1 of 2
2

Looking at what you've shown, I guess there are at least two issues.

First, your path is incorrect. You shouldn't set your path to "/usr/bin/python3.6". I think that's an executable. You should set your path to "/usr/bin/" (which should have been set for you). In that directory, there should be a symbolic link from "python3" to "python3.6" (in /usr/bin/ do a ls -al python*). If what you want is python3, then the above should fix your problem.

You should be able to type "which python3". I don't know what "python" should point to (i.e., python2 or python3...I've lost track if it still points to python2). So, if what you're after is python 2.X, then you should check to see if it has been installed on your system.

Miniconda is a completely different issue. If you've installed Miniconda, you probably need to do a conda activate. This would activate your base environment. Alternatively, if you want to find an environment, then conda activate <some environment>. If you check your path, activating a Miniconda environment essentially prepends its path in front of PATH.

(You might want to double-check that conda is in your path; that is, if it was correctly installed. i.e., which conda Also, the bottom of your ~/.bashrc should have been modified.)

Given what you asked, I guess the second solution is what you wanted. But you should fix your PATH variable anyway.

2 of 2
1

You may not have a file or symbolic link in /usr/bin folder. I made a symbolic link to see something from which python command line:

ln -s /usr/bin/python3.6 /usr/bin/python

🌐
W3Schools
w3schools.com › python › pandas › pandas_cleaning_empty_cells.asp
Pandas - Cleaning Empty Cells
Note: By default, the dropna() method returns a new DataFrame, and will not change the original.
🌐
Python.org
discuss.python.org › python help
Why does the my code return none!? I’m a noob so I don’t know whether the question is overtly stupid or what😃 - Python Help - Discussions on Python.org
July 25, 2021 - This returns none. Ideal behind program is to convert Celsius to Fahrenheit using Fahrenheit = (9/5) * celsius + 32 But when I write return (9/5) * c + 32 it gives the desired result Just curious on the difference between print ((9/5) * c + 32) and return
🌐
Medium
medium.com › @parulharshana › why-your-python-function-isnt-returning-anything-print-vs-return-explained-58d75e893750
Why Your Python Function Isn’t Returning Anything: print() vs return Explained | by Parulharshana | Medium
March 27, 2025 - I remember the first time I spent hours debugging a Python function that was completely correct — yet I wasn’t getting any output. I double-checked my loops, rewrote conditions, even tried rewriting the function from scratch. And then, it hit me: I had used print() instead of return.
🌐
Quora
quora.com › Why-does-the-programming-language-Python-return-none-instead-of-nothing
Why does the programming language Python return none instead of nothing? - Quora
Answer (1 of 3): If a function fails to return you would get Nothing back - if it returns but doesn’t have any value(s) to return then you get back [code ]None [/code]- not that python functions can return more than one thing at a time, may return mixed types and are not required to return ...
🌐
EyeHunts
tutorial.eyehunts.com › home › python function return nothing
Python function return nothing
June 28, 2024 - There is no such thing as "returning nothing" in the Python function. If no explicit return statement is used, Python treats it as returning..
🌐
Python.org
discuss.python.org › ideas
Deprecate bare return statements - Ideas - Discussions on Python.org
August 9, 2019 - FWIW “bare returns” (i.e. return vs return None ) I find are unintuitive as well. I think much of what is being said about bare except can also be said about “bare returns”. And while I feel PEP-8 does make an attempt to clarify this: “”" Be consistent in return statements.