+ 2

Why or when we use (None) in code? What's the benefit in it? When compiler returns its output as (None)?

The (None) section is totally confusing. I can't understand. Can anyone help me with example? Thanks in advance.

24th Feb 2018, 3:16 AM
New_Bin
3 Answers
+ 8
More importantly, a function will (most likely, if following conventions) return None when it doesn't return anything. For example: def func(): print("I return None!") will return None, as there is no return statement. Built-in functions, like print(), will always follow conventions.
24th Feb 2018, 3:37 AM
LunarCoffee
LunarCoffee - avatar
+ 5
Yes, setting a big object reference to None (null in Java) is a good way to explicitly reclaim memory without waiting for garbage collection.
24th Feb 2018, 4:27 AM
Eric Blinkidu
Eric Blinkidu - avatar
+ 4
You can reset a variable with setting itā€™s value to none. Which basically means null in other languages.
24th Feb 2018, 3:26 AM
Toni Isotalo
Toni Isotalo - avatar