Skip to content

Instantly share code, notes, and snippets.

@jasonlvhit
Last active August 29, 2015 13:56
Show Gist options
  • Save jasonlvhit/9287695 to your computer and use it in GitHub Desktop.
Save jasonlvhit/9287695 to your computer and use it in GitHub Desktop.
#代码来自Python 2.7 Lib/wsgiref/utils.py
#__contains__判断一个字典中是否有key, 等同于has_key
_hoppish = {
'connection':1, 'keep-alive':1, 'proxy-authenticate':1,
'proxy-authorization':1, 'te':1, 'trailers':1, 'transfer-encoding':1,
'upgrade':1
}.__contains__
def is_hop_by_hop(header_name):
"""Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header"""
return _hoppish(header_name.lower())
#帅气的用法
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment