[Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)
rantingrickjohnson at gmail.com
Wed Dec 26 01:19:21 CET 2012
On Tuesday, December 25, 2012 4:56:44 PM UTC-6, Steven D'Aprano wrote:
> Rick, what makes you think that this is logically inconsistent?
> "Method" is the accepted name for functions attached to classes. They
> report themselves as "methods":
> There are two built-ins for creating different types of method: the
> classmethod and staticmethod functions. If you don't think that these
> objects should be called "<adjective> method", then what do you think
> that they should be called?
I'm not arguing about against instance method/class method name convention, i am talking about instance variable/class variable; pay attention!
> On the other hand, the terms "instance variable" and "class variable" are
> logically inconsistent with other terminology. It is common practice,
> across dozens or hundreds of languages, to refer to variables by their
Variable have no "type", only the value of variable has a "type".
> (either as declared, in static-typed languages like C or Haskell, or
> as they are expected to hold a value in dynamic languages like Ruby and
> - an integer variable is a variable used to hold an integer;
> - a string variable is a variable used to hold a string;
> - a float variable is a variable used to hold a float;
> - a boolean variable is be a variable used to hold a boolean;
> - for consistency, a class variable should be a variable used to
> hold a class, e.g.:
> classes = [bool, float, MyClass, Spam, Ham, AnotherClass]
> for cls in classes: # cls is a "class variable"
> print "The name of the class is", cls.__name__
> - and similarly for consistency an instance variable should be a
> variable holding some arbitrary instance. Since everything in an
> instance in Python, this last one is too general to be useful.
Your "last one"(sic) comment negates your whole argument of referring to variables by what type the variable references. Since EVERYTHING is an obj then ALL variables should be termed "instance variables" (that's going by your logic of course).
> Unfortunately people coming to Python from certain other languages,
> particularly Java, (mis)use "class variable" to mean something completely
Don't try to confuse us with your illogical ways, Lord Steven. Your sad devotion to that ancient hatred of java has not helped you conjure up logical terminology, or given you enough clairvoyance to find the truth...
More information about the Python-list