Are those features still the same?

F

francogrex

Hi, I'm not a Python programmer but I'm
interested in it and I found this table from
Norvig that dates for some years (I re-posted
it temporarily on my site below to take it out
of context a little). I'm not interested in
any comparisons only in the Python features (
last column), can someone whether the
information in the Python features column is
still correct today. Thanks

http://francoatgrex.tripod.com/
 
S

Steven D'Aprano

Hi, I'm not a Python programmer but I'm interested in it and I found
this table from Norvig that dates for some years (I re-posted it
temporarily on my site below to take it out of context a little). I'm
not interested in any comparisons only in the Python features ( last
column), can someone whether the information in the Python features
column is still correct today. Thanks

http://francoatgrex.tripod.com/

I could quibble on a few minor wordings, but yes, it is broadly correct.
 
P

Peter Otten

francogrex said:
Hi, I'm not a Python programmer but I'm
interested in it and I found this table from
Norvig that dates for some years (I re-posted
it temporarily on my site below to take it out
of context a little). I'm not interested in
any comparisons only in the Python features (
last column), can someone whether the
information in the Python features column is
still correct today. Thanks

The original page is here:

http://norvig.com/python-lisp.html

Yes, the table is fairly up-to-date and general enough to stay up-to-date
for the next few years.

Peter
 
T

Thomas Jollans

Hi, I'm not a Python programmer but I'm
interested in it and I found this table from
Norvig that dates for some years (I re-posted
it temporarily on my site below to take it out
of context a little). I'm not interested in
any comparisons only in the Python features (
last column), can someone whether the
information in the Python features column is
still correct today. Thanks

Mostly all true, with a few changes and inaccuracies. And a definite
bias towards the LISP. (and the author didn't even specify a dialect on
lisp. My my...)

"Support heterogeneous lists" ==> "Yes (array)"

This is nonsense, and has always been.
Python lists (not arrays) have always been heterogeneous. They store
objects and don't care about the type. Python arrays (from the array
module) are homogeneous, and limited to storing numerical data. Quite a
different beast.
"Number of implementations" ==> [...]branches[...]

I wouldn't cann Jython a branch. You could say that there are currently
two major branches of the Python language, and the CPython interpreter:
Python 2.x and Python 3.x. There are a number of implementations of
Python, the big names being CPython, Jython, IronPython, and PyPy
Data types:

Python 2's int and long (there called integer and bignum) are now
(Python 3.x) a single type.
Again, the author of the table reveals that he is is a lisp programmer
only passingly acquainted with Python: Python lists are *not* arrays.
They are (linked) lists. They're not identical to lisp (cons'd) lists,
but they are, nonetheless, lists, not arrays.
Exceptions:

string exceptions, as demonstrated in the table, are gone in Python 3.
"no other control structures"

now that's a bit hard on Python. Technically true perhaps, but the
author could have mentioned generators somewhere.
function application

apply is gone in Python 3.x -- use the fn(*args) syntax instead.
Also, execfile("file.py") is NOT identical to import file.
other high-order functions

Check out itertools and functools. (std library)
"close over writable var"

Can be done in Python 3.x with the nonlocal keyword. Also, to a point,
objects have always supported the same behaviour, with a twist.
FEATURES
"quotation"

The way this is presented doesn't really fit with Python. Very lisp way
to look at quotation.
"operations on arrays"

ahem.
 
B

Brian Quinlan

This is nonsense, and has always been.
Python lists (not arrays) have always been heterogeneous. They store
objects and don't care about the type. Python arrays (from the array
module) are homogeneous, and limited to storing numerical data.
Quite a
different beast.

He means that Python lists are implemented using arrays, not that the
Python "array" module provides the functionality.

Cheers,
Brian
 
P

Peter Otten

Thomas said:
This is nonsense, and has always been.

I think you are misunderstanding that statement. Python's list stores its
items in a continuous chunk of memory, a layout that is called array in
common CS terminology as opposed to lists which are typically linked lists.

Peter
 
T

Thomas Jollans

He means that Python lists are implemented using arrays, not that the
Python "array" module provides the functionality.

Oh dear, and all this time I thought python lists where implemented as
lists, without ever checking the code.
 
T

Terry Reedy

Hi, I'm not a Python programmer but I'm
interested in it and I found this table from
Norvig that dates for some years (I re-posted
it temporarily on my site below to take it out
of context a little). I'm not interested in
any comparisons only in the Python features (
last column), can someone whether the
information in the Python features column is
still correct today. Thanks

http://francoatgrex.tripod.com/

As other have said, mostly, but I would change the following:

Number of implementations should be "Many, one main'

add Set ............?? set() before Hashtable/dict

change Function entry to def f(x): return x+x \n lambda x: x+x
or even remove mention of lambda. Anyone who thinks the table is the
whole story and tries Python without knowing about def will think Python
braindead.

Other loops: '## works on any sequence ' change sequence to iterable.

Assignment: add x,*y = 1,2,3
Add augmented assignment: x += 1

"No other control structures" is simply wrong. 'and' and 'or' are
control structures as much as if-else expressions. Ditto for
list/set/dict comprehensions and generator expressions.

Comments "## hash mark to end of line" just one hash mark

Someone mentioned apply, execfile is now(3.x) exec(open())

"No other higher-order functions built-in" wrong. func.partial,
decorators, others mentioned

'No keywords on map/reduce/filter' ?? I do not know what these are, but
I suspect Python can produce the same effect somehow. this looks like
some lisp detail picked out as something Python does not directly have.

Someone mention nonlocal to write enclosed vars.

Compilation is an implementation, not a language feature. There have
been lisp inerpreters in the past, if not now, and there are Python
compilers now, if not in the past.

Declarations Standard Python has 2, the Cython dialect has 'declarations
for efficiency' just as do some lisp dialects.

Quotation: lambda quotes an entire expression, and is used for one of
the same purposes as list quotation, to suppress immediate execution.
Lisp has one

The Python equivalent of (cons x y) should just be the direct equivalent
y.append(x). Python grows and shrinks list as the 'tail', lisp at the
'head'. Or, the lisp column should include the O(n) lisp code equivalent
to [x]+y.

The python equivalent (car x) is x.pop(). That for (cdr x) is x.pop();x,
which is O(1), not O(n). Again, if the table ha the O(n) way to operate
on a Python list as the 'wrong' end, it should have the same slow way to
operate on the 'wrong' end of a lisp list. What that would show is that
it is a lot easier to operation on the 'wrong' end of a Python list that
the 'wrong' end of a Lisp list. Comparing the wrong Python way with the
right Lisp way is unfair if not dishonest.
 
F

francogrex

Terry said:
As other have said, mostly, but I would change the following...

Thanks for all those who replied. I know these are not all the features but
some of them and again this is not a comparison but a little taste of what
python offers today, and the replies were very informative. By the way Peter
Norvig is not biased, he works for Google research and is a supporter of
programming in any language, especially in Python.
 
L

Lawrence D'Oliveiro

By the way Peter Norvig is not biased, he works for Google research and is
a supporter of programming in any language, especially in Python.

Bias doesn’t have to be a conscious thing.
 
T

Thomas Jollans

Thanks for all those who replied. I know these are not all the features but
some of them and again this is not a comparison but a little taste of what
python offers today, and the replies were very informative. By the way Peter
Norvig is not biased, he works for Google research and is a supporter of
programming in any language, especially in Python.

Had I known the table was headed with "Python for Lisp programmers", I
would have responded differently - but you chose to hide that ;-)
 
M

Mithrandir

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bias doesn’t have to be a conscious thing.

Correct. It just has to have a rainbow logo and own half the internet. :)

- --
People should read more.
https://secure.wikimedia.org/wikipedia/en/wiki/User:MithrandirAgain
"All that is gold does not glitter,
not all those who wander are lost;
the old that is strong does not wither,
deep roots are not reached by the frost.
- From the ashes a fire shall be woken,
a light from the shadows shall spring;
renewed shall be blade that was broken,
the crownless again shall be king."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMT5VTAAoJEKo37V1xH7gTobAH/1QY0SN6BulkNO3QUFrzg5cO
OkeDTbTmI4BJ1M/hmkECU+T76KfnkQ13NobLroWt/UJU8YA4lOQ6KsJU/EsR/27n
TFrUxs3gDVeWyiKdSbWtVSZ7b7BJ8Tr41hMPkA1wyK85qJW5mA19h0hndqs/BRtg
j2GWPLNv9wx7+v0gQnv7ZgSQJHSlRvp8oi016QVl3W7OcO6B0rgwWx4i1hxz/oij
Wd1jF5wwhtgw/0durTFFVt7mR31l3/6zz2WrwvC9fQkSKNQ0oaNgKXZOtctWVdcV
XNm+W9I9Sx70F1qO+VfFrHIRJ+kzjCf6/48bumaygol4MnbLIJ3lJ1BNIESIFAg=
=iv9B
-----END PGP SIGNATURE-----
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top