Posts: 409 / Nickname: bv / Registered: January 17, 2002 4:28 PM
Python's Design Goals
January 19, 2003 9:15 PM
Artima.com has published Part II of an interview with Python creator Guido van Rossum in which he discusses how he originally intended Python to "bridge the gap between the shell and C," and how it eventually became used on large scale applications.---xj40dkcfea73---Artima.com has published Part II of an interview with Python creator Guido van Rossum in which he discusses how he originally intended Python to "bridge the gap between the shell and C," and how it eventually became used on large scale applications.
Here's an excerpt:
The addition of privates was another small language change that was meant to make writing large programs easier. To me, it's mostly useful to address people's irrational fears than act as a practical tool. There are situations where privates are very useful, because you know you have your own namespace. But in many cases, I think it is overused.
People who fear that someone will call their code with the wrong arguments, and who are used to having static-typed language prevent that at the compiler level, will try to prevent that happening in their code by adding explicit assertions. People will check the types. They'll think, "Oh, this only works for strings, so now I'll assert that the input argument is a string."
That is the completely wrong approach, because someone could easily implement something that works just as well with your code and behaves sufficiently like a string. Maybe it's a proxy for a string, which behaves in almost every aspect as a string, except that its type is a proxy. That's something we use in Zope a lot. The persistency mechanism uses proxies, as does the security mechanism that executes untrusted Web- submitted code. Untrusted code is executed in a sandbox environment using proxies for objects that the code shouldn't be accessing directly. So the fact that the language doesn't enforce types at either the compiler level or the implementation level is actually helpful.
What do you think of Guido's comments in the article? In particular, what's your opinion about the utility and proper use of privates?
Posts: 1 / Nickname: kulinux / Registered: August 27, 2002 1:12 AM
Re: Python's Design Goals
January 31, 2003 6:07 AM
As you say the original idea where Python is intented to "bridge the gap between the shell and C" is excellent. Also Python is a nice language in which to learn programming. But we do not agree that Python is useful when building large applications.
For instance, the improvement and maintenance of an application with 10,000 lines (not 500 lines) could be a nightmare if it has not been properly structured following a strict methodology (coding conventions, naming conventions, etc ...). Even in the best scenarios the debug is really complex, any changes to the code introduce risks to the system (you are not safe even using JUnit).
From the point of view of Object Oriented Programming (OOP) languages, the current Python implementation has several inconveniences (interfaces, access control, etc ...).
So to make a few comments on "Usefulness of privates". Do you really think they are "overused in many cases" ????
If so, has the progress achieved during the last 20 years in OOP been for nothing??
A thought. If I wrote a new chapter to Tolkiens ?Lord of the Rings?, I would at least make sure that all the races in Middle Earth were present and that none of them had experienced sudden out of character personality changes !
And about Zope, we think it is better not to speak about it. We must persevere with it ! .... :((