Seeking review of an article about Python's origins

  • Context: Python 
  • Thread starter Thread starter harborsparrow
  • Start date Start date
  • Tags Tags
    article Review
Click For Summary
SUMMARY

The forum discussion centers on the origins of Python and clarifies misconceptions regarding its object-oriented (OO) capabilities. Contrary to claims that Python was not designed to be OO until version 3, it is established that user-defined classes have been part of Python since version 2. The explicit use of 'self' in class methods has been a requirement since the introduction of classes in early versions, not a new feature of Python 3. The discussion emphasizes the deliberate design choices made by Python's creator, Guido van Rossum, to enhance clarity and explicitness in the language.

PREREQUISITES
  • Understanding of Python programming language, specifically versions 2 and 3
  • Familiarity with object-oriented programming concepts
  • Knowledge of Python's design philosophy, particularly the Zen of Python
  • Awareness of Python's version history and release notes
NEXT STEPS
  • Research the differences between Python 2 and Python 3, focusing on class definitions
  • Explore the Zen of Python and its impact on language design
  • Read Guido van Rossum's discussions on Python's design choices, especially regarding 'self'
  • Examine the evolution of Python's standard library and its use of user-defined classes
USEFUL FOR

Python programmers, software developers transitioning from Java or C++, and educators teaching object-oriented programming concepts will benefit from this discussion.

harborsparrow
Gold Member
Messages
728
Reaction score
244
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
Technology news 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.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
1K
Replies
54
Views
7K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 21 ·
Replies
21
Views
2K
  • · Replies 13 ·
Replies
13
Views
886
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
5
Views
4K