PrakharPythonProgrammer / Grail-0.6

This is the Project Grail-0.6 version released in the year 1999 and we're trying to port this from Python 1 to Python 3.
Other
21 stars 6 forks source link

Remove unnecessary code #13

Closed PrakharPythonProgrammer closed 3 years ago

PrakharPythonProgrammer commented 3 years ago
def more_complete_challenge_parse(self):        
        return

        challenge = headers['www-authenticate']
        # <authscheme> realm="<value>" [, <param>="<value>"] ...
        parts = string.splitfields(challenge, ',')
        p = parts[0]
        i = string.find(p, '=')
        if i < 0: return
        key, value = p[:i], p[i+1:]
        keyparts = string.split(string.lower(key))
        if not(len(keyparts) == 2 and keyparts[1] == 'realm'): return
        authscheme = keyparts[0]
        value = string.strip(value)
        if len(value) >= 2 and value[0] == value[-1] and value[0] in '\'"':
            value = value[1:-1]

In this code why did we do all this if we just wanted to return nothing. The code below return won't get executed so why did we write all this code. What is the purpose of it @gvanrossum ?

gvanrossum commented 3 years ago

It's a funny way of commenting out code that's no longer used but the author at the time didn't want to throw away.

PrakharPythonProgrammer commented 3 years ago

I think it's good way. This way one can have the code with him and if he needs to use it in future or as a reference than it can be very useful.

On Wed, Jun 2, 2021, 21:10 Guido van Rossum @.***> wrote:

It's a funny way of commenting out code that's no longer used but the author at the time didn't want to throw away.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PrakharPythonProgrammer/Grail-0.6/issues/13#issuecomment-853134195, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUCW2RYBGX77H6N7MNBYPNDTQZGF5ANCNFSM456KSJ6A .