Q:

Why does cookielib.LWPCookieJar accept an empty argument list?

In the cookielib documentation, the definition of cookielib.LWPCookieJar is:
class cookielib.LWPCookieJar(filename, delayload=None, policy=None)

The filename is a required argument.
But in the following python code, LWPCookieJar has no argument, yet still works.
import cookielib
cookie = cookielib.LWPCookieJar()

Who knows why?

A:

Because the documentation is lying, apparently.
cookielib.py imports the definition of LWPCookieJar from _LWPCookieJar.py, which defines it as:
class LWPCookieJar(FileCookieJar):
    ...

FileCookieJar is defined in cookielib.py, as:
class FileCookieJar(CookieJar):
    """CookieJar that can be loaded from and saved to a file."""

    def __init__(self, filename=None, delayload=False, policy=None):
    ...

So the filename argument is actually optional (and delayload defaults to False, not None).

