[Python-Dev] Style guide for FAQs?

2011-12-03 Thread Antoine Pitrou

Hello,

I notice that some FAQs are not only outdated but seem to favour a
writing style that's quite lengthy and full of anecdotal details.
It seems to me that there is value in giving terse answers in FAQs (we
have - or should have - reference documentation where things are
explained in more detail).

One primary example is the performance question:
file:///home/antoine/cpython/32/Doc/build/html/faq/programming.html#my-program-is-too-slow-how-do-i-speed-it-up

It mixes a couple of generalities with incredibly specific suggestions
such as early binding of methods or use of default argument values to
fold constants. I think a beginner reading this entry won't get any
meaningful information out of it.

Any advice on whether it's ok to hack and slash into the fat? :)

Regards

Antoine.


___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Style guide for FAQs?

2011-12-03 Thread Antoine Pitrou
On Sat, 3 Dec 2011 21:39:03 +0100
Antoine Pitrou  wrote:
> 
> One primary example is the performance question:
> file:///home/antoine/cpython/32/Doc/build/html/faq/programming.html#my-program-is-too-slow-how-do-i-speed-it-up

Woohoo. This should of course be:
http://docs.python.org/dev/faq/programming.html#my-program-is-too-slow-how-do-i-speed-it-up

cheers

Antoine.


___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Style guide for FAQs?

2011-12-03 Thread Terry Reedy

On 12/3/2011 3:58 PM, Antoine Pitrou wrote:

On Sat, 3 Dec 2011 21:39:03 +0100
Antoine Pitrou  wrote:


One primary example is the performance question:
file:///home/antoine/cpython/32/Doc/build/html/faq/programming.html#my-program-is-too-slow-how-do-i-speed-it-up


Woohoo. This should of course be:
http://docs.python.org/dev/faq/programming.html#my-program-is-too-slow-how-do-i-speed-it-up


That looks like a mini-howto ;-),
rather than a FAQ entry.

The changes you have made so far have looked good to me.

--
Terry Jan Reedy

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] cpython (3.2): Issue #13211: Add .reason attribute to HTTPError to implement parent class

2011-12-03 Thread Nick Coghlan
On Sun, Dec 4, 2011 at 12:46 AM, jason.coombs
 wrote:
> +def test_HTTPError_interface():
> +    """
> +    Issue 13211 reveals that HTTPError didn't implement the URLError
> +    interface even though HTTPError is a subclass of URLError.
> +
> +    >>> err = urllib.error.HTTPError(msg='something bad happened', url=None, 
> code=None, hdrs=None, fp=None)
> +    >>> assert hasattr(err, 'reason')
> +    >>> err.reason
> +    'something bad happened'
> +    """
> +

Did you re-run the test suite after forward-porting to 3.3? I'm
consistently getting failures:

$ ./python -m test test_urllib2
[1/1] test_urllib2
**
File "/home/ncoghlan/devel/py3k/Lib/test/test_urllib2.py", line 1457,
in test.test_urllib2.test_HTTPError_interface
Failed example:
err = urllib.error.HTTPError(msg='something bad happened',
url=None, code=None, hdrs=None, fp=None)
Exception raised:
Traceback (most recent call last):
  File "/home/ncoghlan/devel/py3k/Lib/doctest.py", line 1253, in __run
compileflags, 1), test.globs)
  File "",
line 1, in 
err = urllib.error.HTTPError(msg='something bad happened',
url=None, code=None, hdrs=None, fp=None)
TypeError: HTTPError does not take keyword arguments
**
File "/home/ncoghlan/devel/py3k/Lib/test/test_urllib2.py", line 1458,
in test.test_urllib2.test_HTTPError_interface
Failed example:
assert hasattr(err, 'reason')
Exception raised:
Traceback (most recent call last):
  File "/home/ncoghlan/devel/py3k/Lib/doctest.py", line 1253, in __run
compileflags, 1), test.globs)
  File "",
line 1, in 
assert hasattr(err, 'reason')
NameError: name 'err' is not defined
**
File "/home/ncoghlan/devel/py3k/Lib/test/test_urllib2.py", line 1459,
in test.test_urllib2.test_HTTPError_interface
Failed example:
err.reason
Exception raised:
Traceback (most recent call last):
  File "/home/ncoghlan/devel/py3k/Lib/doctest.py", line 1253, in __run
compileflags, 1), test.globs)
  File "",
line 1, in 
err.reason
NameError: name 'err' is not defined
**
1 items had failures:
   3 of   3 in test.test_urllib2.test_HTTPError_interface
***Test Failed*** 3 failures.
test test_urllib2 failed -- 3 of 65 doctests failed
1 test failed:
test_urllib2
[142313 refs]

Now, this failure is quite possibly due to a flaw in the PEP 3151
implementation (see http://bugs.python.org/issue12555), but picking up
this kind of thing is the reason we say to always run the tests before
committing, even for a simple merge.

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com