Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-10 Thread Vinay Sajip
On Dec 3, 12:12 am, Terry Reedy tjre...@udel.edu wrote: At the moment (3.1) there are, unfortunately, library packages that require % for formatting (logging, I believe, for one). There has been discussion on adding a new option for 3.2, but I do not know what will happen. Depends on whether

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-03 Thread Mark Summerfield
On 2 Dec, 22:49, John Posner jjpos...@optimum.net wrote: On Wed, 02 Dec 2009 13:34:11 -0500, Carsten Haese   carsten.ha...@gmail.com wrote: With string interpolation, you don't need to do that, either. '%*d' % (8,456) '     456' Thanks, Carsten and Mark D. -- I'd forgotten about the

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-03 Thread Mark Summerfield
On 2 Dec, 20:59, MRAB pyt...@mrabarnett.plus.com wrote: Mark Summerfield wrote: On 2 Dec, 19:28, David H Wild dhw...@talktalk.net wrote: In article 351fcb4c-4e88-41b0-a0aa-b3d63832d...@e23g2000yqd.googlegroups.com,    Mark Summerfield l...@qtrac.plus.com wrote: I only just found out

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-03 Thread Mark Summerfield
On 3 Dec, 01:17, Antoine Pitrou solip...@pitrou.net wrote: Le Tue, 01 Dec 2009 06:03:36 -0800, Mark Summerfield a écrit : I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. It is aimed at

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-03 Thread Wolodja Wentland
On Wed, Dec 02, 2009 at 08:03 -0800, Mark Summerfield wrote: On Dec 2, 11:20 am, Wolodja Wentland wentl...@cl.uni-heidelberg.de It would be quite nice if you could mark all the Python 3 idioms that work in Python 2.X as well. This would allow readers that are still using Python 2.X and are

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-03 Thread David H Wild
In article 9d290ad6-e0b8-4bfa-92c8-8209c7e93...@a21g2000yqc.googlegroups.com, Mark Summerfield l...@qtrac.plus.com wrote: There is a typographical fault on page 4 of this pdf file. The letter P is missing from the word Python at the head of the comparison columns. I can't see that

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-03 Thread Mark Summerfield
On 2 Dec, 21:28, David H Wild dhw...@talktalk.net wrote: In article 9d290ad6-e0b8-4bfa-92c8-8209c7e93...@a21g2000yqc.googlegroups.com,    Mark Summerfield l...@qtrac.plus.com wrote: There is a typographical fault on page 4 of this pdf file. The letter P is missing from the word Python at

Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Summerfield
I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. It is aimed at existing Python 2 programmers who want to start writing Python 3 programs and want to use Python 3 idioms rather than those from Python 2

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Summerfield
On 1 Dec, 17:50, Mark Dickinson dicki...@gmail.com wrote: On Dec 1, 2:03 pm, Mark Summerfield l...@qtrac.plus.com wrote: I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. Very nice indeed!

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Summerfield
On 1 Dec, 18:30, Lie Ryan lie.1...@gmail.com wrote: On 12/2/2009 1:03 AM, Mark Summerfield wrote: I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. It is aimed at existing Python 2 programmers

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Summerfield
On 1 Dec, 21:55, Terry Reedy tjre...@udel.edu wrote: Mark Summerfield wrote: I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. It is aimed at existing Python 2 programmers who want to start

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Summerfield
On 1 Dec, 23:52, John Bokma j...@castleamber.com wrote: Mark Summerfield l...@qtrac.plus.com writes: It is available as a free PDF download (no registration or anything) from InformIT's website. Here's the direct link: http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/...

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Dickinson
On Dec 2, 8:01 am, Mark Summerfield l...@qtrac.plus.com wrote: On 1 Dec, 17:50, Mark Dickinson dicki...@gmail.com wrote: My only quibble is with the statement on the first page that the 'String % operator is deprecated'.  I'm not sure that's true, for all values of 'deprecated'.  There

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Wolodja Wentland
On Wed, Dec 02, 2009 at 00:10 -0800, Mark Summerfield wrote: On 1 Dec, 18:30, Lie Ryan lie.1...@gmail.com wrote: Also, I'm not sure what this change is referring to: Python 2                 Python 3 L = list(seq)            L = sorted(seq) L.sort() L.sort is still available in

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Martin P. Hellwig
Mark Summerfield wrote: cut It is available as a free PDF download (no registration or anything) from InformIT's website. Here's the direct link: http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/python/python2python3.pdf cut Very handy! Am I wrong in assuming that you forgot

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Summerfield
On Dec 1, 2:03 pm, Mark Summerfield l...@qtrac.plus.com wrote: I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. It is aimed at existing Python 2 programmers who want to start writing Python 3

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Summerfield
On Dec 2, 8:53 am, Mark Dickinson dicki...@gmail.com wrote: On Dec 2, 8:01 am, MarkSummerfieldl...@qtrac.plus.com wrote: On 1 Dec, 17:50, Mark Dickinson dicki...@gmail.com wrote: My only quibble is with the statement on the first page that the 'String % operator is deprecated'.  I'm not

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Summerfield
On Dec 2, 11:20 am, Wolodja Wentland wentl...@cl.uni-heidelberg.de wrote: On Wed, Dec 02, 2009 at 00:10 -0800, Mark Summerfield wrote: On 1 Dec, 18:30, Lie Ryan lie.1...@gmail.com wrote: Also, I'm not sure what this change is referring to: Python 2                 Python 3 L =

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Summerfield
On Dec 2, 11:31 am, Martin P. Hellwig martin.hell...@dcuktec.org wrote: MarkSummerfieldwrote: cut It is available as a free PDF download (no registration or anything) from InformIT's website. Here's the direct link: http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/...

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Summerfield
On Dec 2, 4:22 pm, Mark Summerfield l...@qtrac.plus.com wrote: On Dec 2, 11:31 am, Martin P. Hellwig martin.hell...@dcuktec.org wrote: MarkSummerfieldwrote: cut It is available as a free PDF download (no registration or anything) from InformIT's website. Here's the direct link:

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread John Posner
On Wed, 02 Dec 2009 10:55:23 -0500, Mark Summerfield l...@qtrac.plus.com wrote: On Dec 1, 2:03 pm, Mark Summerfield l...@qtrac.plus.com wrote: I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. It

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Carsten Haese
John Posner wrote: Goal: place integer 456 flush-right in a field of width 8 Py2: %%%dd % 8 % 456 Py3: {0:{1}d}.format(456, 8) With str.format(), you don't need to nest one formatting operation within another. With string interpolation, you don't need to do that, either. '%*d' %

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Dickinson
On Dec 2, 4:41 pm, John Posner jjpos...@optimum.net wrote:   Goal: place integer 456 flush-right in a field of width 8    Py2: %%%dd % 8 % 456    Py3: {0:{1}d}.format(456, 8) With str.format(), you don't need to nest one formatting operation within   another. A little less mind-bending, and

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread David H Wild
In article 351fcb4c-4e88-41b0-a0aa-b3d63832d...@e23g2000yqd.googlegroups.com, Mark Summerfield l...@qtrac.plus.com wrote: I only just found out that I was supposed to give a different URL: http://www.informit.com/promotions/promotion.aspx?promo=137519 This leads to a web page where you can

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread John Bokma
Mark Summerfield l...@qtrac.plus.com writes: On 1 Dec, 23:52, John Bokma j...@castleamber.com wrote: Mark Summerfield l...@qtrac.plus.com writes: It is available as a free PDF download (no registration or anything) from InformIT's website. Here's the direct link:

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Mark Summerfield
On 2 Dec, 19:28, David H Wild dhw...@talktalk.net wrote: In article 351fcb4c-4e88-41b0-a0aa-b3d63832d...@e23g2000yqd.googlegroups.com,    Mark Summerfield l...@qtrac.plus.com wrote: I only just found out that I was supposed to give a different URL:

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread MRAB
Mark Summerfield wrote: On 2 Dec, 19:28, David H Wild dhw...@talktalk.net wrote: In article 351fcb4c-4e88-41b0-a0aa-b3d63832d...@e23g2000yqd.googlegroups.com, Mark Summerfield l...@qtrac.plus.com wrote: I only just found out that I was supposed to give a different URL:

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread John Posner
On Wed, 02 Dec 2009 13:34:11 -0500, Carsten Haese carsten.ha...@gmail.com wrote: With string interpolation, you don't need to do that, either. '%*d' % (8,456) ' 456' Thanks, Carsten and Mark D. -- I'd forgotten about the use of * in minimum-field-width specs and precision specs

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Terry Reedy
Mark Summerfield wrote: Well it seems clear to me that the BDFL wants to kill of % formatting, but wasn't able to for Python 3... Definitely. I thought of adding autonumbering of fields (in 3.1) in response to his inquiry about the barriers to moving to .format. That solved 'simplicity of

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Antoine Pitrou
Le Tue, 01 Dec 2009 06:03:36 -0800, Mark Summerfield a écrit : I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. It is aimed at existing Python 2 programmers who want to start writing Python 3

Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-01 Thread Mark Summerfield
I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. It is aimed at existing Python 2 programmers who want to start writing Python 3 programs and want to use Python 3 idioms rather than those from Python 2

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-01 Thread Daniel Fetchinson
I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. It is aimed at existing Python 2 programmers who want to start writing Python 3 programs and want to use Python 3 idioms rather than those from

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-01 Thread Gnarlodious
On Dec 1, 7:03 am, Mark Summerfield wrote: Programming in Python 3 (Second Edition) ISBN-10: 0321680561. I ordered it... -- Gnarlie http://Gnarlodious.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-01 Thread Mark Dickinson
On Dec 1, 2:03 pm, Mark Summerfield l...@qtrac.plus.com wrote: I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. Very nice indeed! My only quibble is with the statement on the first page that the

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-01 Thread Lie Ryan
On 12/2/2009 1:03 AM, Mark Summerfield wrote: I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. It is aimed at existing Python 2 programmers who want to start writing Python 3 programs and want to use

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-01 Thread Terry Reedy
Mark Summerfield wrote: I've produced a 4 page document that provides a very concise summary of Python 2-3 differences plus the most commonly used new Python 3 features. It is aimed at existing Python 2 programmers who want to start writing Python 3 programs and want to use Python 3 idioms

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-01 Thread John Bokma
Mark Summerfield l...@qtrac.plus.com writes: It is available as a free PDF download (no registration or anything) from InformIT's website. Here's the direct link: http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/python/python2python3.pdf Thanks! And of course, if you