Noob in Python. Problem with fairly simple test case

Steven D'Aprano steve at pearwood.info
Fri Jul 17 04:44:43 CEST 2015


It amuses me that this discussion started because the OP stated explicitly
that he uses Python 3, and Rick gave an answer for Python 2. Rather than
accept his mistake, Rick's defence is that practically nobody uses Python
3. (Presumably he means "apart from the guy who actually asked the
question".)

More comments below:


On Fri, 17 Jul 2015 10:30 am, Ranting Rick wrote:

> On Thursday, July 16, 2015 at 6:24:21 PM UTC-5, Chris Angelico wrote:
> 
> Any attempt to translate downloads into *REAL* usage
> statistics is doomed to be unreliable. Chris, you're smarter
> than this!
> 
> (1) for instance: Python2.x coders have been around long
> enough that they don't need to download as much from PyPi
> anymore. Whereas, Python3.x coders are more recent, therfor
> they will be downloading the majority of packages these
> days.

Translation: "It's only old dinosaurs that use Python 2! Newcomers to the
language are moving straight to Python 3!".


> (2) Also. Old and stable code bases do not change as much as
> new unstable code bases tend to do. Therfor, less Python2.x
> downloads

Translation: "Python 2 code is abandoned and no longer being actively
maintained. If you want code that's actually being worked on, Python 3 is
the place to go."


> (3) The numbers are falsified even more by 3.0 packages that
> are downloaded, but never actually used. Maybe the package
> was not what the downloaded expected it to be. I have
> downloaded many packages from PyPi and never used the
> majority of them.

Translation: "I don't use many libraries outside of what's in the standard
library."


I don't necessarily agree with *any* of these things, except for the initial
comment that it's difficult to tell exactly how many people are using any
specific version of Python. That at least is true. But:

- I think it is ridiculous to suggest that just because somebody has been
using Python for many years, they no longer need to download packages from
PyPI.

- While it's true that old stable code doesn't change, most heavily used
code is under active development for security updates, bug fixes, and new
features. This is *particularly* true now that Python 3 is in the picture.
The great majority of non-abandoned packages on PyPI have been, or are in
the process of being, updated to support Python 3.

- It's a dishonest argument to suggest that people download Python 3
packages but never use them, without acknowledging that the same applies to
Python 2 packages. By default, pip installs Python 2 packages, so if
anything the rate of "downloaded but not used" errors will be slightly
higher for Python 2 than Python 3. (It's easy for somebody to accidentally
download an unwanted Python 2 version of a package, but hard to download an
unwanted Python 3 version.)


>> Even if you don't correct for that, these figures show *at
>> most* 30-50% more Py2 usage than Py3, which hardly
>> justifies Rick's statement that the "vast majority" of
>> Python is 2.x.
>> 
> 
> I think I've dispelled the validity of your assertion and
> the weakness inherent in your mental heuristic. As my
> logical reasoning demonstrates, your percentages of 30%-50%
> are, at best, on the *LOW* end of the real percentages of
> Python2.x usage.

I believe Rick has misunderstood Chris' comment. Chris is not saying that
30-50% of Python users are using Python 2. He's saying that there are
30-50% *more* Python 2 users than Python 3, that is, for each Python 3 user
there are 1.3 to 1.5 Python 2 users, i.e. about 40% Python 3 versus 60%
Python 2.

I think that undercounts two sorts of users:

- those who are behind corporate or government firewalls;

- and those using only packages available via their Linux distro's package
management (yum, apt-get, etc)

neither of whom will be represented well by PyPI downloads, and both of
those will be mostly using Python 2. In other words, I think Chris is
overcounting Python 3 users.

My sense is that:

- A lot of newcomers to Python are starting with Python 3; quite a few
schools and colleges which teach Python now start with Python 3. From the
evidence I've seen on the tutor mailing list, I'd estimate that newcomers
are probably 40% Python 3.

- Established Python users of the sort who spend a lot of time talking about
Python on the Internet (e.g. here, on Reddit, Stackoverflow, blogging) tend
to be relatively early adopters of Python 3. Reddit, for example, is
extremely (and sometimes obnoxiously so) pro-Python 3. My estimate is that
there's probably about 60% Python 3 usage.

- Government and corporate users tend to be the opposite of early adaptors,
more like late or never adaptors. The majority of them won't upgrade to 3
until the last possible minute. Some will never upgrade -- there are still
people using Python 2.3 and even 1.5 who have no intention of upgrading to
2.7, let alone 3.x. My guess -- and this really is a plucked-from-thin-air
guess -- is that probably 5% or less are using Python 3. I think that this
group of users are the only ones where Rick's "vast majority" is plausible.

- Scientists are heavy users of Python, and the majority of them will still
be using Python 2. Although both numpy and scipy support Python 3, and so
does IPython, scientists tend to be almost as conservative as government
and corporate users. (They often *are* government and corporate users.) My
guestimate is that there's probably about 15% Python 3 take-up.

My take from all this is that overall, Python 3 take-up is probably around
10% of all Python users, but it's the most influential 10%: newbies
learning Python 3 at school, the people chatting about Python on the
Internet, writing blog posts and answering questions on Stackoverflow.
Furthermore, there's probably another 30% who *want* to use Python 3 but
cannot due to company policy. In my day job, I fall into that category: the
company I work for use Python as their main language for our flagship
application, and by policy we're stuck with using the default Python on
Debian jessie, which is 2.6. The numbers of people actively hostile to
Python 3 is probably less than 10%.

The take-up rate of Python 3 is about where we would expect after less than
seven years: 

- the majority of popular third-party libraries and frameworks now support
Python 3;

- one or two Linux distros have Python 3 as their system Python;

- most of the big distros (Red Hat, Fedora, Centos, Debian, Ubuntu) are well
into their preparation to do the same;

- educators are well into the move to Python 3;

- and popular awareness of Python 3 is high and mostly positive.



-- 
Steven



More information about the Python-list mailing list