Patches item #1478993, was opened at 2006-04-29 09:43
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1478993&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: John J Lee (jjlee)
Assigned to: Nobody/Anonymous (nobody)
Summary: Take advantage of BaseException/Exception split in cookielib

Initial Comment:
The patch takes advantage of the exception hierarchy
reorganisation to remove some ugly code in cookielib. 
It clarifies a couple of exception messages, too.


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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-04-29 17:37

Message:
Logged In: YES 
user_id=33168

John, at this point (2.x) we should at least do no worse. 
Don't export unnecessary vars in any new code.  We should
also start documenting the situation and work towards
improving it.  For 3k, we should do better and solidify the
rules and do massive cleanup (module by module).  This will
probably involve some arm twisting of Guido. :-)

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

Comment By: John J Lee (jjlee)
Date: 2006-04-29 17:27

Message:
Logged In: YES 
user_id=261020

I changed the exception detail strings to use %r to get
quotes around the filename and quoted "bad" line read from
the file.  That makes it clearer what is part of the
explanatory English text and what is part of the filename
(or part of the quoted bad line, as the case may be). 
Filenames can and do contain spaces, commas, etc.

Your other point stunned me a bit.  I don't think it had
ever even really *occurred* to me that stdlib users might
consider stdlib module globals that are not documented as
public.  Ironically, I think that's because the code from
which cookielib derives is much stricter about this, all
modules starting with '_' and package __init__ exporting a
short list of names -- I guess I thought I was following
stdlib conventions by *not* adding initial underscores all
over the place.  Looking at some other stdlib code, I see
that underscores would have been more conventional after all.

Searching for reassurance, I discovered this from one of
your old python-dev summaries that confirms that
undocumented stdlib module globals are not considered part
of the module public interface:

http://www.python.org/dev/summary/2004-07-16_2004-07-31/#use-the-docs-to-know-what-the-public-api-is-people

e.g. from Tim Peters:

"""
As you noted later, it wasn't part of keyword's documented
interface, and you *always* act at your own risk when you go
beyond the docs.
"""

However, I don't see that this is explicitly documented,
which seems unfortunate to me (even though Tim's statement
is true regardless of any convention Python might have).

So, I guess I should:

1. Write something explicit about this (along the lines of
"Use undocumented module globals at your own risk") for the
stdlib library docs -- perhaps starting from Tim's post --
and submit that as a doc patch.

2. Leave all module global names in cookielib unchanged (so
people using those functions don't suffer gratuitous
breakage, even though any such people are asking for trouble
in the long run).  However, in the thread above, Michael
Hudson disagrees with that, and suggests all such module
globals be renamed.  So suggestions are welcome here on the
best course of action.

3. As you suggest, submit a patch to add an __all__ to
cookielib.


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

Comment By: Brett Cannon (bcannon)
Date: 2006-04-29 14:12

Message:
Logged In: YES 
user_id=357491

Overall the patch looks fine (on vacation so not up for
applying and handling any possible failures so not going to
assign to myself).  But a question and a suggestion.

Why were the error strings changed to use the repr instead
of the string representation?  What does it buy you?

And if you are going to be changing the function name, you
might want to consider using a leading underscore to prevent
people from using it or getting exported.  Otherwise I would
define __all__ for the module.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1478993&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches

Reply via email to