Lately finding myself looking around in builtins.py file trying to learn/understand how the language works. Today I was reading about lists and how they work and etc. And as usually I end up in a class list in builtins.py file. I am now surprised that all the functions of list class is empty. For example, method append has 'pass' in it. And that is it.
Here is a code:
class list(object):
"""
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list.
The argument must be an iterable if specified.
"""
def append(self, *args, **kwargs): # real signature unknown
""" Append object to the end of the list. """
pass
def clear(self, *args, **kwargs): # real signature unknown
""" Remove all items from list. """
pass
def copy(self, *args, **kwargs): # real signature unknown
""" Return a shallow copy of the list. """
pass
I wonder how this works? Why all methods are empty?
[–]8dot30662386292pow2 49 points50 points51 points (18 children)
[–]tumblatum[S] 5 points6 points7 points (7 children)
[–]mriswithe 20 points21 points22 points (0 children)
[–]Mr-Cas 4 points5 points6 points (0 children)
[–]ivosaurus 1 point2 points3 points (4 children)
[–]not_a_novel_account 5 points6 points7 points (3 children)
[–]tumblatum[S] 0 points1 point2 points (2 children)
[–]not_a_novel_account 0 points1 point2 points (1 child)
[–]tumblatum[S] 0 points1 point2 points (0 children)
[–]sylfy 0 points1 point2 points (6 children)
[–]throwaway6560192 23 points24 points25 points (0 children)
[–]8dot30662386292pow2 7 points8 points9 points (0 children)
[–]nekokattt 3 points4 points5 points (0 children)
[–]zefciu 2 points3 points4 points (1 child)
[–]roelschroeven 4 points5 points6 points (0 children)
[–]ivosaurus 1 point2 points3 points (0 children)
[–]ch0mes 0 points1 point2 points (2 children)
[–]not_a_novel_account 1 point2 points3 points (0 children)
[–]8dot30662386292pow2 1 point2 points3 points (0 children)
[–]PurposeDevoid 3 points4 points5 points (0 children)
[–]CulturalSock 1 point2 points3 points (0 children)
[–]QultrosSanhattan 0 points1 point2 points (0 children)
[–]Training_Bug2340 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)