Python 3

Russel Winder russel at russel.org.uk
Wed Jun 23 06:52:52 BST 2010


Robert,

On Wed, 2010-06-23 at 09:47 +1200, Robert Collins wrote:
[ . . . ]
> print foo, bar -> print("%s %s" % (foo, bar))
[ . . . ]

Just to protect against creation of misinformation:


print foo , bar  ->  print ( foo , bar )

Also the "%s" and % operator are deprecated in Python 3, so:

print ( "%s %s" % ( foo , bar ) ) -> print ( "{} {}".format ( foo ,
bar ) )


> except Foo, e:
> ->
> except Foo:
>     e = sys.exc_info()[1] 

Why?

except Foo , e : ->  except Foo as e :


I find that the following document is very helpful:

http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/python/python2python3.pdf

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at russel.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20100623/93205e6c/attachment.pgp 


More information about the bazaar mailing list