| 
									
										
										
										
											2019-05-17 11:55:34 +02:00
										 |  |  | .. highlight:: c
 | 
					
						
							| 
									
										
										
										
											2008-01-20 09:30:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. _noneobject:
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-19 16:29:26 +03:00
										 |  |  | The ``None`` Object
 | 
					
						
							|  |  |  | -------------------
 | 
					
						
							| 
									
										
										
										
											2008-01-20 09:30:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-04 11:04:41 +01:00
										 |  |  | .. index:: pair: object; None
 | 
					
						
							| 
									
										
										
										
											2008-01-20 09:30:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-06 10:11:56 +00:00
										 |  |  | Note that the :c:type:`PyTypeObject` for ``None`` is not directly exposed in the
 | 
					
						
							| 
									
										
										
										
											2008-01-20 09:30:57 +00:00
										 |  |  | Python/C API.  Since ``None`` is a singleton, testing for object identity (using
 | 
					
						
							| 
									
										
										
										
											2023-07-27 18:44:32 +03:00
										 |  |  | ``==`` in C) is sufficient. There is no :c:func:`!PyNone_Check` function for the
 | 
					
						
							| 
									
										
										
										
											2008-01-20 09:30:57 +00:00
										 |  |  | same reason.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-06 10:11:56 +00:00
										 |  |  | .. c:var:: PyObject* Py_None
 | 
					
						
							| 
									
										
										
										
											2008-01-20 09:30:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-21 21:13:25 +01:00
										 |  |  |    The Python ``None`` object, denoting lack of value.  This object has no methods
 | 
					
						
							| 
									
										
										
										
											2023-11-17 15:09:19 +01:00
										 |  |  |    and is :term:`immortal`.
 | 
					
						
							| 
									
										
										
										
											2008-01-20 09:30:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-17 15:09:19 +01:00
										 |  |  |    .. versionchanged:: 3.12
 | 
					
						
							|  |  |  |       :c:data:`Py_None` is :term:`immortal`.
 | 
					
						
							| 
									
										
										
										
											2008-01-20 09:30:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-06 10:11:56 +00:00
										 |  |  | .. c:macro:: Py_RETURN_NONE
 | 
					
						
							| 
									
										
										
										
											2008-01-20 09:30:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-21 21:13:25 +01:00
										 |  |  |    Return :c:data:`Py_None` from a function.
 |