Python Forum
What does None mean here? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: What does None mean here? (/thread-21416.html)



What does None mean here? - jenniferruurs - Sep-29-2019

What does None mean here?
Does it mean that it should be initialized as empty, but if there is input it can be overridden?
class ListNode:
    
    def __init__(self, data=None, next=None):
        self.data = data
        self.next = next



RE: What does None mean here? - buran - Sep-29-2019

None is default value of data and next. If you don't pass any of these during instantiation of the class object it will use the default values.

as a side note next is built-in function, better don't use it as param name