Seeking review of an article about Python's origins

  • Context: Python 
  • Thread starter Thread starter harborsparrow
  • Start date Start date
  • Tags Tags
    article Review
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
8 replies · 2K views
harborsparrow
Gold Member
Messages
732
Reaction score
248
TL;DR
Kirby Urner has written a new article on the origins of Python, and we are looking for people to review and comment on the article.
Dear Python programmers,

There is a new article on the "origins of Python" at https://en.citizendium.org/wiki/Python_(programming_language)

The Citizendium is a partner site with Physics Forums (cross-linked); we are looking for Python programmers to review and comment on the new article (on its Discussion page). If you have time and interest, please go at it, and thanks in advance.

I've been following the various Python discussions on here. It is one of the few current languages I've never had cause to use much, so I will be interested to know what you all have to say. Or, you can leave your comments here and I will relay them to Kirby, the article's author, from this forum.

Thanks in advance,

Pat
 
  • Like
Likes   Reactions: berkeman
on Phys.org
Well I see one glaring error. Python wasn’t designed to be OO until version 3 and classes were introduced. Earlier pythons were more traditional scripting languages.

I could be wrong but in 3 when I saw the self addition explicitly needed for each class and it’s attributes, I felt that OO was tacked on to python.
 
It reads like ad copy.
 
  • Like
Likes   Reactions: jedishrfu
jedishrfu said:
Python wasn’t designed to be OO until version 3 and classes were introduced.

This is not correct. Python has had the class statement, allowing user-defined classes and instances of them, since at least early in version 2. (I have been programming in Python since version 2.3, and I was using the class statement then.) Even "new-style classes", which are the only kind of classes in Python 3, were introduced midway in version 2 (version 2.4 or 2.5, I think).

jedishrfu said:
in 3 when I saw the self addition explicitly needed for each class and it’s attributes

I have no idea what you are talking about here. Explicit self for class attributes and methods has been required in Python ever since the class statement was introduced, early in version 2. They were certainly not something new that was added in version 3, any more than the class statement itself.
 
Interesting thanks for the clarification on the class statement. From my experience though I didn’t see it used in any scripts unless they were v3 based. My apologies.

The self comment is because of my background in java where self is not an explicit argument in any instance method like it is in python. To my mind it was tacked on to the language as opposed to baked into the design of the language. I haven’t found a reason for this convention.
 
jedishrfu said:
To my mind it was tacked on to the language as opposed to baked into the design of the language.

No, it wasn't, it was a deliberate design decision from the beginning.

jedishrfu said:
I haven’t found a reason for this convention.

The short version is one of the items from the Zen of Python: Explicit is better than implicit. In a language like C++ or Java, with an implicit "this", you can't tell just from looking at a variable reference inside a member function whether it is a reference to an instance variable or to a global defined elsewhere. In a member function in Python, you know exactly which variable references are to instance variables just by looking at them: the ones with self.

There is also the issue that, if a "self" parameter is implicit, the interpreter has to figure out when to add it to a function. Since Python allows methods to be dynamically added to classes after they are defined, this is not at all straightforward the way it is in C++ or Java.

For some discussion of the explicit self convention (including a discussion of the issue I just described) by Guido van Rossum, see here:

http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to-stay.html
 
  • Like
Likes   Reactions: jbunniii
jedishrfu said:
From my experience though I didn’t see it used in any scripts unless they were v3 based.

Python libraries and programs that use user-defined classes have been around as long as Python has. The Python standard library itself contains many of them, and has since the earliest versions.

If you haven't been programming in Python for many years, it's quite likely that your experience of Python prior to v3 overall is very limited. Python 3 has been around since 2008 and has been gaining traction steadily since about 2012 or so, when Python 3.3 was released--that was the first Python 3 version that was actually more usable than Python 2 and fixed enough of the mistakes made in earlier Python 3 versions to make people seriously consider starting to migrate legacy code.