Python 3 is killing Python

wxjmfauth at gmail.com wxjmfauth at gmail.com
Wed Jul 16 03:11:57 EDT 2014


Le mercredi 16 juillet 2014 07:52:31 UTC+2, Marko Rauhamaa a écrit :
> Steven D'Aprano <steve+comp.lang.python at pearwood.info>:
> 
> 
> 
> > On Tue, 15 Jul 2014 23:01:25 +0300, Marko Rauhamaa wrote:
> 
> >> In fact, I find the lazy use of Unicode strings at least as scary as
> 
> >> the lazy use of byte strings, especially since Python 3 sneaks
> 
> >> Unicode to the outer interfaces of the program (files, IPC).
> 
> >
> 
> > I'm not entirely sure I understand what you mean by "lazy use of
> 
> > Unicode strings". And I especially don't understand what you mean by
> 
> > "sneak". The fact that strings are Unicode is *the* biggest and most
> 
> > obvious new feature of Python 3.
> 
> 
> 
> I mean that sys.stdin and sys.stdout should deal with byte strings. I
> 
> mean that open(path) should open a file in binary mode. Thankfully, the
> 
> subprocess methods exchange bytes by default.
> 
> 
> 
> To me, the main difference between Python 2 and Python 3 is that in the
> 
> former, I use "..." everywhere, and in the latter, I use b"..."
> 
> everywhere. If I should need advanced text processing features, I'll go
> 
> through a decode() and encode().
> 
> 
> 
> > The Python devs aren't slaves, they get to choose what features they
> 
> > work on and which they don't. They don't owe *anybody* any feature
> 
> > they don't want to build, or care to support, and that includes
> 
> > continuing the 2.x series.
> 
> 
> 
> No need to erect straw men. Of course, the Python gods do whatever they
> 
> want. And you asked me to clarify my opinion, which I did. The breakage
> 
> of backward compatibility wasn't worth the new features.
> 
> 
> 
> But as I said, what is done is done. We'll live with the reality.
> 
> 
> 
> > As of right now, *new* projects ought to be written in Python 3.3 or
> 
> > better, unless you have a compelling reason not to. You don't have to
> 
> > port old projects in order to take advantage of Python 3 for new
> 
> > projects.
> 
> 
> 
> But my distro only provides Python 3.2. What's wrong with Python 3.2?
> 
> Why didn't anybody tell me to put off the migration?
> 
> 
> 
> 
> 
> Marko

-----------


>From a unicode perspective, Py32 is the best
Python. (Yes it's ucs2).

(From a BDFL example)

>>> sys.version_info
sys.version_info(major=3, minor=2, micro=5, releaselevel='final', serial=0)
>>> timeit.repeat("a = 'hundred'; 'x' in a")
[0.09090468709446498, 0.07743860966057525, 0.07695655307486504]
>>> timeit.repeat("a = 'hundre EURO'; 'x' in a")
[0.09373873872100091, 0.07633783502242864, 0.0762649751626725]


sys.version_info
sys.version_info(major=3, minor=4, micro=0, releaselevel='final', serial=0)
timeit.repeat("a = 'hundred'; 'x' in a")
[0.1174619090622306, 0.09338822371994088, 0.09350361798433393]
timeit.repeat("a = 'hundre EURO'; 'x' in a")
[0.2306057883810979, 0.21599837108983877, 0.2168407886036121]


>>> sys.version_info
sys.version_info(major=3, minor=4, micro=0, releaselevel='final', serial=0)
>>> sys.getsizeof('hundred')
32
>>> sys.getsizeof('hundre EURO')
52


>>> sys.getsizeof('hundred')
44
>>> sys.getsizeof('hundre EURO')
44


Just an illustration of a systematical behaviour.
Not only Py32 works much better than Py33+,
it works much better for non ascii users!


The Py devs succeeded to transform Python into
a ascii product!

In my mind, it would be nicer to spend time in
solving bugs, instead of reinventing "unicode".
And before reinventing "unicode", it would be
good to undersand it (I fell by chance on
a video: "The Guts of Unicode in Python").


Hobbyist tools will alway stay hobbyist tools.

------

Something different, "micropython". Luckily
they are people who are understanding "unicode"
as whole very correctly and are not following
py devs advices. I'm thinking about this
UEFI stuff. It is beyond my knowledge. it seems to me
that it is a similar situation.

jmf




More information about the Python-list mailing list