Not fully OO ?

J

James Mills

This is wrong. Python _is_ a full OOP language.
Everything form modules, functions to basic data types are an object.

--JamesMills
 
K

Kay Schluehr

Excerpt quoted fromhttp://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.

This is somewhat true. But what is OO, really?

Answer: if you want to define an entity it has to be defined inside a
class. If you want to access an entity you have to use the dot
operator. Therefore Java is OO but Python is not.
 
F

Fredrik Lundh

Kay said:
Answer: if you want to define an entity it has to be defined inside a
class. If you want to access an entity you have to use the dot
operator. Therefore Java is OO but Python is not.

you're satirising the quoted author's cargo-cultish view of object
orientation, right?

</F>
 
C

Carl Banks

Excerpt quoted fromhttp://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.

Python is what it is, whatever you call it. That page has a whole
list of features (we'll give the author the benefit of the doubt and
assume they're accurate and fairly up-to-date). Those features (more
or less) define what Python is, not trendy computer science catch
words.


Carl Banks
 
C

Colin J. Williams

candide said:
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.

"foreach: for x in array: statements
Loops over the array given by array. On
each iteration, the value of the current
element is assigned to x and the
internal array pointer is advanced by one. "

This could be a useful addition to Python.

numarray is no longer supported. It has
been supplanted by numpy.

How is OOP defined?

Colin W.
 
F

Fredrik Lundh

Colin said:
"foreach: for x in array: statements
>
Loops over the array given by array. On each iteration, the value of the
current element is assigned to x and the internal array pointer is
advanced by one. "

This could be a useful addition to Python.

for-in could be a useful addition to Python? looks like Guido's used
his time machine again, then, since it's been around since the pre-1.0 days:

http://www.python.org/doc/ref/for.html

</F>
 
M

Martin v. Löwis

for-in could be a useful addition to Python? looks like Guido's used
his time machine again, then, since it's been around since the pre-1.0
days:

http://www.python.org/doc/ref/for.html

He somehow must have misinterpreted

http://www.astro.ufl.edu/~warner/prog/python.html

which has the exact text he quoted. Unfortunately, this text has
foreach in bold, so he might have assumed foreach to be a keyword
(despite the example to the right demonstrating the contrary).

What this has to do with OO, or with numpy, is beyond me.

Regards,
Martin
 
S

Steven D'Aprano

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*
 
K

Kay Schluehr

you're satirising the quoted author's cargo-cultish view of object
orientation, right?

</F>

I wonder if the OO fetish hasn't already lost much of its magic
powers. What are the most powerful fetishes these days? A year ago I
would have suspected "purely functional" but I'm not sure it has
really caught on.
 
E

Eduardo O. Padoan

I wonder if the OO fetish hasn't already lost much of its magic
powers. What are the most powerful fetishes these days? A year ago I
would have suspected "purely functional" but I'm not sure it has
really caught on.

I think the current fetish is paralelism and erlang's share-nothing
concurrency model. Or something like it.

 
T

Thomas G. Willis

Excerpt quoted fromhttp://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.

My comment is "Who cares?"

I was always under the impression that if any language truly was "OO"
it would be smalltalk. And I don't derive any benefit from smalltalk
at all. I do however derive substantial benefit from other languages
that "OO zealots" would likely poo poo on including python.
 
B

Bruno Desthuilliers

candide a écrit :
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.

The following definitions are AFAIK the only commonly accepted
definitions about OO:

1/ an object is defined by identity, state and behaviour
2/ objects interacts by sending messages each other
3/ an OO program is made of interacting objects

I let you find out whether Python meets these 3 definitions - and if
Java does (hint : in Python, everything you can bind to a name is an
object - this is not true in Java or C++).
 
A

Aaron \Castironpi\ Brady

you're satirising the quoted author's cargo-cultish view of object
orientation, right?

</F>

If you define OO as implementation inheritance, then Java is not. It
inherits interface only. Another possibility is, has a virtual
function table. The fact that Python indexes by name doesn't
disqualify it from that definition. I don't know if Java meets it.

I don't think raw C structures would be included, and you can define
function pointers in them.

Wikipedia puts it decently: "mainly for OO programming, but with some
procedural elements."

<ducks>
 
P

Paul Boddie

Wikipedia puts it decently: "mainly for OO programming, but with some
procedural elements."

<ducks>

When it comes to Python and object-oriented programming, you can't
leave out the ducks. ;-)

Paul
 
K

Kay Schluehr

The following definitions are AFAIK the only commonly accepted
definitions about OO:

1/ an object is defined by identity, state and behaviour
2/ objects interacts by sending messages each other
3/ an OO program is made of interacting objects

I let you find out whether Python meets these 3 definitions - and if
Java does (hint : in Python, everything you can bind to a name is an
object - this is not true in Java or C++).

This is correct but it detracts from a more general problem of
language "paradigms".

Assume you type
4

Now you are free to interpret this as a simple, primitive arithmetic
operation but you can also claim that 2 sends an __add__ message to 2.
Hereby the state of the 2 objects are not altered but a new 4 object
is created. OO babble is more impressive isn't it?

Actually it is simply wrong in the mentioned case and here is the
proof:

def foo():
return 2+2

import dis
dis.dis(foo)

2 0 LOAD_CONST 2 (4)
3 RETURN_VALUE

OO is a heuristic method used to understand the semantics of a
programming language. It can also inspire language design but as
you've rightly said: jugde yourself and see how far you get with it.

Applying OO on interpreter level is by no means a sign of a high
quality implementation whereas structuring programs in the large will
likely benefit from class based organization and encapsulation. Of
course one can also reverse the value hierarchy and find perverse joy
in having a pure OO language but apply monkey patching everywhere. I
suppose you know which language I'm talking about...
 
A

Aaron \Castironpi\ Brady

This is correct but it detracts from a more general problem of
language "paradigms".

Assume you type


4

Now you are free to interpret this as a simple, primitive arithmetic
operation but you can also claim that 2 sends an __add__ message to 2.
Hereby the state of the 2 objects are not altered but a new 4 object
is created. OO babble is more impressive isn't it?

Actually it is simply wrong in the mentioned case and here is the
proof:

def foo():
    return 2+2

import dis
dis.dis(foo)

  2           0 LOAD_CONST               2 (4)
              3 RETURN_VALUE

OO is a heuristic method used to understand the semantics of a
programming language. It can also inspire language design but as
you've rightly said: jugde yourself and see how far you get with it.

Applying OO on interpreter level is by no means a sign of a high
quality implementation whereas structuring programs in the large will
likely benefit from class based organization and encapsulation. Of
course one can also reverse the value hierarchy and find perverse joy
in having a pure OO language but apply monkey patching everywhere. I
suppose you know which language I'm talking about...

It sounds like you think that you -can- write OO programs in Python,
but you don't have to. I agree.
 
A

Aaron \Castironpi\ Brady

It's not wrong.

The meaning of the Python program is, internally, on a cycle-by-cycle
basis, "Object 2; send add( Object 2 ) to Object 2; Return object 4."

CPython doesn't do this, but due to the fact that there are no cases
in which that distinction affects the output, it's still an
implementation of Python.

Or at least, a practical implementation.
 
A

Aahz

My comment is "Who cares?"

I was always under the impression that if any language truly was "OO"
it would be smalltalk. And I don't derive any benefit from smalltalk
at all. I do however derive substantial benefit from other languages
that "OO zealots" would likely poo poo on including python.

"...some experts might say a C++ program is not object-oriented without
inheritance and virtual functions. As one of the early Smalltalk
implementors myself, I can say they are full of themselves." --zconcept
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,241
Latest member
Lisa1997

Latest Threads

Top