what's the _junk in codes?

Asked by Kun Huang

 try:
            _junk, dest_container, dest_object = dest.split('/', 2)
        except ValueError:
            return HTTPPreconditionFailed(
                request=req,
                body='Destination header must be of the form '
                     '<container name>/<object name>')

what's that _junk?
correct dest should be "container/object"
but how does that string split into 3 parts?

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Object Storage (swift) Edit question
Assignee:
No assignee Edit question
Solved by:
Mike Barton
Solved:
Last query:
Last reply:
Revision history for this message
Best Mike Barton (redbo) said :
#1

If you try '/container/object'.split('/', 2), you'll get a useless empty string for the first item in the list. We just call it _junk since we don't intend to use it anywhere.

(We used to have a convention of using "_" when we needed a symbol we weren't going to use. Then we pretended for a while like we were going to use gettext, so we just bulk changed all of the "_" symbols to "_junk".)

Revision history for this message
Kun Huang (academicgareth) said :
#2

Thank you
I miss this line:
1096: dest = '/' + dest

Revision history for this message
Kun Huang (academicgareth) said :
#3

Thanks Mike Barton, that solved my question.