[issue10461] Use with statement throughout the docs

2011-03-12 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset cebaf1bdaf78 by Éric Araujo in branch 'default':
Fix example in atexit doc: Both open and read could raise the IOError (#10461 
follow-up).
http://hg.python.org/cpython/rev/cebaf1bdaf78

--
status: pending - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2011-03-12 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thanks for the catch!  I was so used to the idiom where opening the file 
doesn’t fail but you protect the read or write that I didn’t think about the 
issue here.

--
stage: commit review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2011-03-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

 Perhaps something should also be added to the doc style guide (along
 with using 'attributes' instead of 'members').

Terry, could you open another report for that, or maybe just commit the change 
directly?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2011-03-11 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset c3d28c84a372 by Éric Araujo in branch 'default':
Use with statement where it improves the documentation (closes #10461)
http://hg.python.org/cpython/rev/c3d28c84a372

--
nosy: +python-dev
resolution: accepted - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2011-03-11 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

Éric, I'm not sure about the first atexit.rst hunk. I thought the purpose of 
that code was to except IOError when no file is found. I'm not entirely sure 
why in the simplest case infile.read() would raise IOError. I'd think that 
eli's patch (file19667) would suit better.

--
status: closed - pending

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-12-20 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

I've already made the change, Terry, just holding off committing it because 
Georg has frozen the py3k branch until 3.2b2 is released.

There are a few other changes I'm making, will commit these soon after 3.2b2 is 
released.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-12-19 Thread SilentGhost

Changes by SilentGhost michael.mischurow+...@gmail.com:


Removed file: http://bugs.python.org/file19671/logging.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-12-19 Thread SilentGhost

SilentGhost michael.mischurow+...@gmail.com added the comment:

following re-organization of the logging docs, I'm attaching updated patch.

--
nosy: +vinay.sajip
Added file: http://bugs.python.org/file20112/logging-cookbook.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-12-19 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Vinay, you should look at the logging-cookbook patch.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-21 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Éric, please apply most of these.

In the atexit patch, the first change is wrong.  Change it to a 
try/except/finally or skip it altogether.

In the collections patch, only include the change for the tail example; the 
other two should remain unchanged.

Skip the difflib patch entirely.  It unnecessarily makes the example confusing 
and hard to follow.

Change the cmd patch to:
+with open(arg) as f:
+self.cmdqueue.extend(f.read().splitlines())

--
assignee: rhettinger - eric.araujo
resolution:  - accepted
stage: needs patch - commit review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-21 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Removed file: http://bugs.python.org/file19696/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-21 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Raymond: I made a single diff for easier review.  I’m not 100% sure I should 
change 'r' to 'rb' in logging: It’s unrelated to with, and the rest of the file 
has not been checked for similar errors.  I prefer to do commits that don’t mix 
things.

Eli:
 which whitespace change do you refer to. I changed to 4-spaces
 indentation in the code sample to conform to PEP-8. Shouldn't I have?
PEP 8 only applies to Python code.  
http://docs.python.org/dev/documenting/style applies to the docs.

--
Added file: http://bugs.python.org/file19765/with-in-docs-1.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-21 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Éric,

Yes, in a consequent patch I fixed this - kept the formatted code indented at 3 
spaces, while adhering to PEP-8 internally. If there's anything else, let me 
know.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-21 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

 I’m not 100% sure I should change 'r' to 'rb' in logging:
 It’s unrelated to with, and the rest of the file 
 has not been checked for similar errors. 

Good catch.  This should only be a with-statement transformation.  I caught 
other accidental semantic changes, so be continue to exercise care.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

with also replaces open-try-do stuff-finally-close, the correct idiom for 
ensuring file handles are always closes in all VMs.

I don’t think the doc style guide is the right place, since this is a code 
issue.  with is advertised in 
http://docs.python.org/dev/tutorial/inputoutput#methods-of-file-objects and 
http://docs.python.org/dev/howto/doanddont#exceptions ; 
http://docs.python.org/dev/library/functions#open says nothing about closing, 
and http://docs.python.org/dev/library/io tells about the with statement 
without recommending it strongly.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Éric, although grepping for all such references may be tricky, could you 
specify the places where you did see them? I guess a few fixed places is better 
than none at all.

--
nosy: +eli.bendersky

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Certainly.  Here is my secret grep:
$ cd py3k/Doc
$ grep -n --color=auto -d skip -I --exclude-dir .svn --exclude-dir .hg -R 
open\(.*\).read *.rst c-api distutils documenting extending faq howto library 
reference tutorial using

List without false positives: 

faq/library.rst
library/pkgutil.rst
library/atexit.rst
library/pipes.rst
library/cmd.rst
library/logging.rst
library/difflib.rst
library/collections.rst
tutorial/interpreter.rst
tutorial/stdlib2.rst

List for open(.*).write:
faq/library.rst
library/ftplib.rst
library/atexit.rst

There is probably a better regex that would catch “open(.*).[valid method 
name]”, but I hate regexes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Eric, I'm attaching a provisional fix for library/atexit.rst just to be sure 
this is what you mean.

--
Added file: http://bugs.python.org/file19659/atexit.rst

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file19660/issue10461.1.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


Removed file: http://bugs.python.org/file19659/atexit.rst

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Yes, that’s it.  Please don’t change whitespace in your patches.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

FWIW, this doesn't belong in the style guide; it is obvious that the docs 
should exhibit best practice Python code, and using the with statement when 
opening resources is certainly such a best practice now.

--
nosy: +georg.brandl

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Eric, which whitespace change do you refer to. I changed to 4-spaces 
indentation in the code sample to conform to PEP-8. Shouldn't I have?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread SilentGhost

SilentGhost michael.mischurow+...@gmail.com added the comment:

Here is the patch for Docs/library/cmd.rst

--
nosy: +SilentGhost
Added file: http://bugs.python.org/file19663/cmd.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread SilentGhost

SilentGhost michael.mischurow+...@gmail.com added the comment:

Here is the patch for Doc/library/difflib.rst

--
Added file: http://bugs.python.org/file19664/difflib.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

I'm trying to port the example in tutorial/stdlib2.rst, but the sample in 
working with binary data record layouts fails (before my porting to 'with'...)

  struct.error: unpack requires a bytes argument of length 16

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread SilentGhost

SilentGhost michael.mischurow+...@gmail.com added the comment:

Patch for Doc/library/collections.rst

--
Added file: http://bugs.python.org/file19665/collections.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Attaching patches for library/atexit.rst and for tutorial/stdlib2.rst

--
Added file: http://bugs.python.org/file19667/issue10461.atexit.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


Added file: http://bugs.python.org/file19668/issue10461.stdlib2.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


Removed file: http://bugs.python.org/file19660/issue10461.1.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

SilentGhost,

Your patches look fine. I have a doubt re collections.rst, however - about the 
Python prompt. The same issue is in faq/library.rst and I didn't want to touch 
it because I thought that on the prompt personally I probably wouldn't use 
'with' - why write 2 lines when you can write 1? After all, it's just playing 
on the prompt - I don't care about safe closing of the file, etc.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread SilentGhost

SilentGhost michael.mischurow+...@gmail.com added the comment:

patch for Doc/library/logging.rst

Also, note the the change of the mode from `'r'` to `'rb'`. `data_to_send` is 
further send through socket and therefore requires to be bytes.

I expressed my opinion in irc, but I can repeat here that I think only the most 
trivial code such as in Doc/library/pipes.rst isn't worth converting.

--
Added file: http://bugs.python.org/file19671/logging.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread SilentGhost

SilentGhost michael.mischurow+...@gmail.com added the comment:

patch for Doc/library/logging.rst

Also, note the the change of the mode from `'r'` to `'rb'`. `data_to_send` is 
further send through socket and therefore requires to be bytes.

I expressed my opinion in irc, but I can repeat here that I think only the most 
trivial code such as in Doc/library/pipes.rst isn't worth converting.

--
Added file: http://bugs.python.org/file19672/logging.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread SilentGhost

Changes by SilentGhost michael.mischurow+...@gmail.com:


Removed file: http://bugs.python.org/file19672/logging.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Do not change the examples in collections.rst.
That would interfere with the clarify of what
is being demonstrated.  For example, the hamlet.txt
example is not about file reading, it about 
counting words.

--
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread SilentGhost

SilentGhost michael.mischurow+...@gmail.com added the comment:

None of the changes are about file reading, they only about using with 
statement throughout. May be nofix then?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

I think the other (non collections patches) are fine.  The change doesn't break 
up the flow of the text.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Separate note for Éric:  the try/finally examples do not need to change.  Those 
are valid python.   Users need to learn both try/finally and the with-statement.

--
assignee: d...@python - rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

FWIW, I find the with variant much easier to read than

 words = re.findall('\w+', open('hamlet.txt').read().lower())

Too many operations in one line.  It would be even better with

 words = re.findall('\w+', hamlet_text.lower())

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
Removed message: http://bugs.python.org/msg121711

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Eli, SilentGhost: Please open other bug reports for doc errors like the struct 
one in stdlib2 or the r/rb one.

SilentGhost: with statement used with open *is* about file reading :)

Raymond: I agree about try/finally.  I agree with Alexander about 
collections.rst.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-20 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

On Sat, Nov 20, 2010 at 20:44, Éric Araujo rep...@bugs.python.org wrote:


 Éric Araujo mer...@netwok.org added the comment:

 Eli, SilentGhost: Please open other bug reports for doc errors like the
 struct one in stdlib2 or the r/rb one.

 SilentGhost: with statement used with open *is* about file reading :)

 Raymond: I agree about try/finally.  I agree with Alexander about
 collections.rst.


Éric,

It turned out to be a non-issue, never mind.

--
Added file: http://bugs.python.org/file19696/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___div dir=ltrbrdiv class=gmail_quoteOn Sat, Nov 20, 2010 at 20:44, 
Éric Araujo span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/span 
wrote:brblockquote class=gmail_quote style=margin: 0pt 0pt 0pt 0.8ex; 
border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;

div class=imbr
Éric Araujo lt;a href=mailto:mer...@netwok.org;mer...@netwok.org/agt; 
added the comment:br
br
/divEli, SilentGhost: Please open other bug reports for doc errors like the 
struct one in stdlib2 or the r/rb one.br
br
SilentGhost: with statement used with open *is* about file reading :)br
br
Raymond: I agree about try/finally.  I agree with Alexander about 
collections.rst.br/blockquote/divbrÉric,brbrIt turned out to be a 
non-issue, never mind.brbr/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-19 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

+1
I have not yet had occasion to use 'with' yet, but in reading the Unicode HOWTO 
diff, I noticed that I liked replacing 'open,read,close' with 'with open, read' 
just for reading purposes since it turns 3 steps into 1 compound transaction.

Perhaps something should also be added to the doc style guide (along with using 
'attributes' instead of 'members').

--
nosy: +terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-19 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-19 Thread Éric Araujo

New submission from Éric Araujo mer...@netwok.org:

The docs contain numerous examples that would trigger resource warnings under 
3.2 (for example “open(...).read()”).  They should be changed to use (and thus 
promote) the with statement.

Not adding the “easy” keyword, since grepping for those things is not easy.

Not sure we’ll backport that to 3.1 and 2.7.

--
assignee: d...@python
components: Documentation
messages: 121545
nosy: d...@python, eric.araujo
priority: normal
severity: normal
stage: needs patch
status: open
title: Use with statement throughout the docs
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10461] Use with statement throughout the docs

2010-11-19 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

+1

BTW, I've updated examples in Unicode HOWTO to use with.

--
nosy: +belopolsky

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10461
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com