Guido on python3 for beginners
Steven D'Aprano
steve at pearwood.info
Sat Feb 20 02:59:02 EST 2016
On Thu, 18 Feb 2016 07:40 pm, Terry Reedy wrote:
> 8. 2.x has two subtlely different types of classes. The 2.x docs do not
> document the type of builtin and stdlib classes. I discovered that
> tkinter classes are still old-style in 2.7 when I backported a patch
> from 3.x to 2.7 and it mysteriously did not work. Py 3 wins here. To
> me, this alone makes 2.x a bad choice for most beginners.
An excellent point!
> 11. To test is something is text, isinstance s, c), where 'c' is one of
> str, bytes, unicode, basestring, (bytes, unicode), (str, unicode). +1
> for 3.x.
In Python 3, it should be much rarer to want to test whether something is
unicode or bytes. You can't combine them easily, so you rarely want to
handle them in identical ways.
> 12. 2.7 has two different open' functions, open and io.open. In 3.x
> these are the same opjects. I believe there are other 3.x backports
> like this.
There's also codecs.open().
--
Steven
More information about the Python-list
mailing list