Are the critiques in "All the things I hate about Python" valid?

Paul Moore p.f.moore at gmail.com
Mon Feb 19 10:39:00 EST 2018


On 19 February 2018 at 15:18, Ned Batchelder <ned at nedbatchelder.com> wrote:
> On 2/19/18 9:54 AM, Steven D'Aprano wrote:
>>
>> On Mon, 19 Feb 2018 13:28:26 +0000, Paul Moore wrote:
>>
>>> [1] The most basic question, which people making such claims often can't
>>> answer, is "Do you mean that values are strongly typed, or that names
>>> are? Or did you mean that variables are, because if so Python doesn't
>>> even have variables in the sense that you mean" Programming language
>>> semantics are complex.
>>
>> An excellent point.
>>
>> The distinction between typing *values* and *names* is a good one.
>>
>
> I guess I'll have to continue to grit my teeth as people say, "Python
> doesn't have variables."   Why can't we say, "Python's variables work
> differently than other languages"?

Apologies, Ned. I didn't mean to make your teeth sore :-)

I've found that when people refer to "variables" they pretty much
inevitably have a picture in their mind of a named box that "contains"
a value (or pointer to a value). They find it difficult to understand
that Python doesn't have those boxes but rather names the values
directly. Sort of. And yes, that 's very much "sort of". It's
certainly just as viable to say to people that Python's idea of
variables is different than (say) C's, but in my experience you end up
qualifying so much that it's easier to use a different term without
the connotations. Sort of like saying "I like apples - the orange ones
that are a type of citrus fruit" :-)

In common usage I'll happily use the terms "variable" and "name"
somewhat interchangeably, but when things degenerate into detail-level
picking over specifics, I avoid doing so. I was wrong to casually say
"Python doesn't have variables", though - if I want to be detailed and
specific, I should make sure my writing reflects that that's what I'm
doing.

I'm curious - How would you explain Python's "variables" to someone
who knows how C variables work, in a way that ensures they don't carry
across any unfortunate misconceptions based on how C works? If I had a
good way of doing that, maybe I wouldn't need to play apple/orange
games when discussing the subject.

Paul



More information about the Python-list mailing list