Re: Not fully OO ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Duncan Booth

    Re: Not fully OO ?

    candide <candide@free.i nvalidwrote:
    Excerpt quoted from http://www.astro.ufl.edu/~warner/prog/python.html :
    >
    "About Python: Python is a high level scripting language with object
    oriented features.
    (...)
    Python supports OOP and classes to an extent, but is not a full OOP
    language."
    >
    >
    Thanks for any comment.
    General comments about the page:

    Section 2: Poor demonstration of 'global'. The declaration of 'a' as global
    is unnecessary and misleading.

    Section 4: "Maths: Requires import math"
    The supplied examples won't work if you just "import math", they need a
    "from math import ..." (either * or better an explicit list of functions).

    Worse, the random number examples won't work whatever you import as they
    include both 'random.seed()' which assumes 'random' is the module and 'x =
    random()' which requires 'from random import random'.

    Section 5: "Strings do not expand escape sequences unless it is defined as
    a raw string by placing an r before the first quote" What is that supposed
    to mean? Describing triple quoted strings as 'optional syntax' is a bit
    weird too: the syntax is no more optional than any other form of string
    literal, you can use it or not.

    Another pointless example given under the heading 'String Operators':
    Concatenation is done with the + operator.
    Converting to numbers is done with the casting operations:
    x = 1 + float(10.5)

    "String functions" actually mostly describes string methods with "len"
    hidden in the middle but only the example tells you that it is different
    than the other examples.

    Section 6 is all about numarray but bizarrely (for something purporting to
    be an overview of Python) there is nothing at all about either list or dict
    types.

    Section 7 says "There is no switch or case statement so multiple elifs must
    be used instead." omitting to mention other possibly more appropriate
    options such as dicts or inheritance. This is a good indication that the
    author doesn't know much about OOP.

    Section 8 "for x in array: statements" shows that the author doesn't
    understand things like iterators.

    Section 10 has such interesting facts as "Only constant initializers for
    class variables are allowed (n = 1)" or "Objects can be compared using the
    == and != operators. Two objects are equal only if they are the same
    instance of the same object." and an example with a completely spurious
    class attributes, some pointless getter/setter methods, and contorted calls
    to base class methods.

    Section 11 demonstrates again that the author doesn't understand about
    iterable objects.

    I'd say the claim that Python isn't a full OOP language is not the most
    important reason to ignore the page.
  • Steven D'Aprano

    #2
    Re: Not fully OO ?

    On Sat, 20 Sep 2008 13:13:08 +0000, Duncan Booth wrote:
    This is a good indication that the
    author doesn't know much about OOP.
    I think you can drop the last two words :)

    Actually that's unfair -- it looks like he knows quite a bit about the
    metallicity of quasers, but he's just parroting a bunch of Java concepts
    as if Java was the be-all and end-all of object oriented programming,
    which is clearly wrong because we all know that Python's object model is
    the One True OOP.

    *wink*


    --
    Steven

    Comment

    Working...