[Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

Rick Johnson rantingrickjohnson at gmail.com
Thu Dec 27 05:07:53 CET 2012


On Wednesday, December 26, 2012 2:29:13 AM UTC-6, Steven D'Aprano wrote:
> [snip]

I won't reply to your last post on a line-by-line basis because i feel we are straying from my general point: which is that we should NEVER re-interpret existing words (in an illogical manner) whilst transforming them into specific disciplines.

My specific point is that the English word "variable" is unambiguous and transforms smoothly to an abstract idea of an identifier referencing an object, and also, that the reference is "variable" (or has the ability to change). The word "variable" is a WONDERFUL example of transforming existing words into specific esoteric disciplines.

Alternatively, you want to argue that the word "attribute" is a better choice NOT because "variable" cannot transform to a programming context, BUT because you want use "variable" to reference some "attribute" of an object...*smile*..., oh i see.

But seriously, 
What is an "attribute" anyway?

############################################################
#                    Define: Attribute                     #
############################################################
# Noun: A quality or feature regarded as a characteristic  #
# or inherent part of someone or something.                #
############################################################

Interesting. And what about "inherent"?

############################################################
#                     Define: Inherent                     #
############################################################
# Adjective: Existing in something as a permanent,         #
# essential, or characteristic attribute                   #
############################################################

Ahh... so an "attribute" is attached to an entity (okay, we could easily transform the word "entity" to a memory object, but) ...that is "permanent" AND "essential"! OPPS! Here is where your logic breaks down. Variables COULD NOT be considered permanent: neither existentially or referentially. Please re-consider this illogical transformation of the word "attribute".

[Slightly Tangential Meanderings Ahead...]
Okay, now that we've ironed-out the wrinkles in our "variable" and we see how "variable" traverses perfectly into a computing context, i want to talk about how some of our most /ingrained/ syntax is NOT correct! Specifically i want to talk about "class" and "def".

The words "class" and "def" are HORRIBLE choices for defining "classes" (oops, i should say objects, but it seems the brainwashing has run it's coarse!) and "methods/functions". I know, I know, your gut reaction is to _cling_  to what is familiar -- and these words have become FAR TOO familiar to all of us -- but again, let's do some introspection of these words we "THINK" we understand.

Ask yourself. What /is/ a class?

A class is nothing more than a textual template defined by the programmer for which Python reads and creates OBJECTS in memory. If instead of "class" we used the word "object" to define a (wait for it...) "object" we would NOT ONLY be consistent and logical, we would inject more intuitiveness into our language. Can you imagine the confusion a new programmer would feel when told that he must use "classes" to create "objects" when the only definition of classes he understands is "classrooms" and "classifications".

So the correct syntax follows:

OBJECT Car(object):
    def __init__(self)
        #....

same goes for methods/functions

FUNCTION foo(args):
... pass

Of course i would be open to "obj" and "func" respectively (well maybe). But i favor the following syntax for even more intuitive consistency:

define object Car(...):
define function foo(...):

That is a work of logical fine art!. However a new problem arises: "function" an illogical choice. "Procedure" would be the obvious choice, however, old school CS majors YET AGAIN redefined a word into illogic oblivion.

Some people think Python's syntax is great, and i must confess i am one of those people, but even after all of Guido's whining about the failures of ABC's syntax he then went on to commit the same crimes[1]

[1] to a far less degree of course :-).



More information about the Python-list mailing list