[Python-bugs-list] [ python-Bugs-458463 ] HTTPSConnect.__init__ too tricky

noreply@sourceforge.net noreply@sourceforge.net
Fri, 28 Jun 2002 16:38:33 -0700


Bugs item #458463, was opened at 2001-09-04 17:27
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=458463&group_id=5470

Category: Python Library
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 3
Submitted By: Rich Salz (rsalz)
>Assigned to: Jeremy Hylton (jhylton)
Summary: HTTPSConnect.__init__ too tricky

Initial Comment:
The code in HTTPSConnect's ctor is way too tricky.  How
about this:
   for k in x509.keys():
     if k not in ['key_file', 'cert_file']:
       raise InvalidKeywordArgument()
if you NEED to be clever then use a list comprehensive
  if [ k for k in x509.keys() if k not in
['key_file','cert_file']]:
    raise InvalidKeywordArgument()

(It's also inefficient copying the keys only to delete
them, in case you need a real justification. ;)


----------------------------------------------------------------------

>Comment By: Jeremy Hylton (jhylton)
Date: 2002-06-28 23:38

Message:
Logged In: YES 
user_id=31392

Fixed as Guido suggested in rev. 1.53 of httplib.py


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-04 18:36

Message:
Logged In: YES 
user_id=6380

Looks like your alternative still makes a copy.

What I personally don't get about that piece of code is why
the function doesn't just declare arguments with default
values of None and be done with it.

Assigned to Greg Stein for judgement. Personally, I'd say
there are bigger fish to fry. :-)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=458463&group_id=5470