f



Python

To what extent are APLers aware of Python's array oriented
capability?    My group is in the process of comparing various
languages in their ability to represent a generic filter estimation
problem in missile defense.   I was surprised to see my APL2 version
translated to Python in almost line-for-line fashion, with very
similar execution efficiency.    What are Python's pros and cons
generally?   Thanks.

0
Jack
8/25/2008 5:15:41 AM
comp.lang.apl 1696 articles. 2 followers. Post Follow

17 Replies
1037 Views

Similar Articles

[PageSpeed] 21

On Aug 25, 7:15=A0am, Jack <jgr...@comcast.net> wrote:
> To what extent are APLers aware of Python's array oriented
> capability?

I can't talk about the general pros and cons of Python, but I have
looked briefly at the language and the numerical library which I
believe goes under than name of NumPy. I have also had the pleasure of
meeting the author of the NumPy a few times... Jim Hugunin , who I
believe is on the "Dynamic Languages" team at Microsoft, acknowledges
that the library was inspired by APL in some of the introductory
texts.

It is true that with NumPy, Python contains functions (or should I say
"methods") which work on arrays and that you can translate a subset of
APL more or less line-by-line to NumPy (as you can to SmartArrays, or
using Dyalogs APL-to-C# translator). Performance will depend very much
on what you are doing. For example, I don't believe NumPy offers bit
booleans, and many APL interpreters have highly tuned algorithms for
common APL idioms.

In my opinion, the MAIN problem with translation to NumPy, SmartArrays
or C# is that these languages don't function as a "tool of though" for
array thinking. In the resulting code, "methods" take a list of
parenthesised, comma-separated arguments, which turns expressions
"inside out", making them much less readable (IMHO). Also, although
the notion of passing function pointers does exist in many other
languages than APL, without an infix, operator-aware notation, the
languages just do not assist array-oriented thinking in the way that
the APL does.

I maintain that APL is a more appropriate "Tool of Thought" for
working in any area where array processing algorithms are changing. I
suspect that many APL development environments also have features
which are finely tuned to support this kind of R&D.
0
Morten
8/25/2008 1:47:59 PM
Yes, I agree with Morten on this.

On Python generally, I've played with it, and it is an interesting
language. (We might well add an interface to from APLX, in the same
way that we have with Ruby). However, it has one feature which seems
to me so spectacularly bad that I personally would never touch it,
namely the fact that the program logic depends on white-space
indentation.  Hence:

if x < 0:
      x = 0
      print 'Blah blah'

means something different than:

if x < 0:
      x = 0
print 'Blah blah'

In general, if you want a Python-style language, Ruby seems to me to a
better choice.

(Just my personal opinion you understand.  Python lovers: Please send
hate-mail to /dev/null)

Richard Nabavi
MicroAPL Ltd
0
microapl
8/26/2008 9:34:04 AM
It's actually worse. This:

> if x < 0:
> =A0 =A0 =A0 x =3D 0
> =A0 =A0 =A0 print 'Blah blah'

might be perfectly well-formed Python code while this

> if x < 0:
>       x =3D 0
>       print 'Blah blah'

might not.

<tabs> are not permitted in Python...

Kai
0
kai
8/26/2008 4:33:42 PM
Semantically valid indentation, that IS a bit weird... :-) But it
could be made to work if you used an editor that enforced indentation
rigorously. Gupta SQLWindows (later Centura and subsequently off the
market, I believe) came equipped with one of these. It was actually
quite convenient, you never had to think about indentation - it just
happened automagically.
I've never seen this idea catch on anywhere else -  makes one wonder
what the drawback is. "Prettyprinting" can do the same thing, of
course, only then it's to late to be of any real use.

On the topic of appearances:  Semantic color-coding has helped
immensely in modern editors. But it is all based on character
foreground colours. What about background colours? One might have an
option to put different background colours (light pastels, I suggest)
on blocks of code (say between pairs of parens or brackets). This
would be especially useful in legacy applications where deeply nested
blocks (and expressions with lots of parens) are common.

Perhaps less useful in well-written APL where you are more able to
avoid excessive "blocking".

Thoughts, anyone ?

0
admin9974
8/26/2008 9:00:43 PM
kai wrote:
> <tabs> are not permitted in Python...

Huh?  Tabs are fine in Python programs and are
replaced with spaces equivalent to 8-character
tab stops by the Python lexer.
0
Stuart
8/27/2008 1:21:10 AM
On Aug 27, 2:21=A0am, Stuart McGraw <smcg...@acedialup.com> wrote:
> kai wrote:
> > <tabs> are not permitted in Python...
>
> Huh? =A0Tabs are fine in Python programs and are
> replaced with spaces equivalent to 8-character
> tab stops by the Python lexer.

The APL wiki runs on MoinMoin which is a Python Wiki. When changing
the configuration it happens from time to time that I forget about
this and press accidentically the <tab> key  - that results in a
"configuration error".

I am using the latest version of MoinMoin/Python with standard config.
It MIGHT be the case that one can change this somehow but I doubt
that: there are warnings in MoinMoin everywhere to add <tab> chars.
0
kai
8/27/2008 5:56:46 AM
Stuart McGraw wrote:
> kai wrote:
>> <tabs> are not permitted in Python...
> 
> Huh?  Tabs are fine in Python programs and are
> replaced with spaces equivalent to 8-character
> tab stops by the Python lexer.

I believe that depends on whether the tabs actually reach Python

some editors may already have substituted more or less than 8 spaces 
before saving the script
0
phil
8/27/2008 7:34:36 AM
On Aug 26, 11:00=A0pm, admin9...@hotmail.com wrote:
> Semantically valid indentation, that IS a bit weird... :-)

Python is not the only language with semantically valid indentation.
Haskell is another. I'd rather have that than ignored whitespaces
(like in Fortran...). ^__^
--
Stefano
0
WildHeart
8/27/2008 7:48:58 AM
microapl@microapl.demon.co.uk wrote:
> Yes, I agree with Morten on this.
> 
> On Python generally, I've played with it, and it is an interesting
> language. (We might well add an interface to from APLX, in the same
> way that we have with Ruby). However, it has one feature which seems
> to me so spectacularly bad that I personally would never touch it,
> namely the fact that the program logic depends on white-space
> indentation.  Hence:
> 
> if x < 0:
>       x = 0
>       print 'Blah blah'
> 
> means something different than:
> 
> if x < 0:
>       x = 0
> print 'Blah blah'

ah, the little things that turn people off

David Barron said he would never touch a language which returned "false" 
to the expression   1<2<3

another prof would never touch a language whose errors messages 
consisted of only 2 words, one of which was ERROR

a lot of people shy away from languages where   2�3+4   evaluates to 14

I knew somebody who wouldn't buy an otherwise suitable house because the 
present occupants had furnished it throughout with plastic imitation 
wood grain, and it looked tacky

there again, somebody else wouldn't buy a house because she didn't like 
the wallpaper in the downstairs loo

I never liked the way Unix shell scripts treated explicit tabs 
differently from a visually identical sequence of spaces, but there's a 
big difference between "not liking" and "never touching"

/phil
0
phil
8/27/2008 8:04:15 AM
On 27 Aug, 09:04, phil chastney
<phil.hates.s...@amadeus.munged.eclipse.co.uk> wrote:
>
> ah, the little things that turn people off
>

Phil, the whitespace behaviour of Python is definitely not a 'little
thing', nor is my objection to it a matter of my personal taste. (From
an aesthetic point of view, I actually like it - it is fine when
you're reading a program, and it reduces clutter). My objection is
based on decades of experience of using many programming languages,
and in particular on merging and maintaining complex source files.  It
is extremely easy for indentation to get messed up accidentally.  OK,
the editor might try to save you, but if you're cutting and pasting
from a section of code with a different indentation level, you can't
guarantee this. That is why I said what I did - bitter experience, and
many hours spent hunting down bugs in complex programs.

In computing, anything that can go wrong, will go wrong.

Richard Nabavi
MicroAPL Ltd
0
microapl
8/27/2008 9:32:37 AM
<microapl@microapl.demon.co.uk> wrote in message 
news:6434c8d6-f51a-4e77-8cb9-6d08ba92adeb@d77g2000hsb.googlegroups.com...

....snipped very good information

>
> In computing, anything that can go wrong, will go wrong.
>
> Richard Nabavi
> MicroAPL Ltd

And the corollary:  "anything that cannot go wrong, will also go wrong"

cheers

Kerry Liles
(ex IPSA zoo) 


0
Kerry
8/27/2008 1:36:14 PM
Does it follow that:

Anything that seems right, is probably wrong?

David 


0
David
8/27/2008 7:02:02 PM
"David Liebtag" <DavidLiebtag@vermontel.net> wrote in message 
news:1219863638.410549@r2d2.vermontel.net...
> Does it follow that:
>
> Anything that seems right, is probably wrong?
>
> David
>

No, it follows that something that's right is wrong and something that's 
wrong is right ... and the other way around
\^jk 


0
jk
8/27/2008 7:59:20 PM
On Aug 27, 10:32 am, micro...@microapl.demon.co.uk wrote:

> Phil, the whitespace behaviour of Python is definitely not a 'little
> thing', nor is my objection to it a matter of my personal taste.

Richard, I respectfully disagree. I've been using Python regularly
since 2001. It's my second favorite language, and for some tasks I
prefer it to APL.

In all that time, I've been bitten by semantic whitespace about 3
times, and it's never taken more than one minute to sort the problem
out.

The main reason: I develop using the Eclipse IDE with a Python plug-
in. It auto-indents, deals with tabs, and gives me immediate feedback
if I write something that's syntactically incorrect. Of course YMMV,
but there are some very smart people using Python for very large
applications (in Google and NASA, for example).

Romilly
0
romilly
8/28/2008 8:26:06 AM
On Aug 25, 2:47 pm, Morten Kromberg <mk...@dyalog.com> wrote:

> In my opinion, the MAIN problem with translation to NumPy, SmartArrays
> or C# is that these languages don't function as a "tool of though" for
> array thinking.

I agree. I've used SmartArrays to build a very successful application
for a Banking customer, but I purchased an APL license at my own
expense because APL let me prototype my ideas so much faster.

Romilly
0
romilly
8/28/2008 8:30:56 AM
On 27 Aug, 20:02, "David Liebtag" <DavidLieb...@vermontel.net> wrote:
> Does it follow that:
>
> Anything that seems right, is probably wrong?
>
> David

Actually, yes.  In our (non-APL) code conversion work, we see a lot of
what seems to be very high-quality, well-tested, mission-critical
code.  Examples include software for medical devices, fail-safe
computing systems, computer-aided manufacturing, railway control
systems, etc - code where you jolly well hope there are no errors.  In
every case, without exception, our code analysis tools have found
potentially serious bugs.

My favourite example was a very well-known and highly regarded company
we were trying to sell to.  They were very sceptical, but we persuaded
them to let us spend some time at their development centre putting
their code through our conversion tools.  The tools gave various
errors messages and warnings, and their technical guy said - "What are
all these errors?  Your tool is rubbish."  So we looked at the part of
their code which had provoked the errors, and discovered that, for
testing purposes, someone had commented-out a crucial line of code,
had failed to put it back, and so the program logic didn't make any
sense.  Just at that moment the boss walked in to see how we were
getting on.

We got the sale.

Richard Nabavi
MicroAPL Ltd
0
microapl
8/28/2008 10:34:25 AM
On Wed, 27 Aug 2008 08:04:15 GMT, phil chastney
<phil.hates.spam@amadeus.munged.eclipse.co.uk> wrote:

> microapl@microapl.demon.co.uk wrote:
> > Yes, I agree with Morten on this.
> > 
> > On Python generally, I've played with it, and it is an interesting
> > language. (We might well add an interface to from APLX, in the same
> > way that we have with Ruby). However, it has one feature which seems
> > to me so spectacularly bad that I personally would never touch it,
> > namely the fact that the program logic depends on white-space
> > indentation.  <snip>

> ah, the little things that turn people off <snip others>
> I never liked the way Unix shell scripts treated explicit tabs 
> differently from a visually identical sequence of spaces, but there's a 
> big difference between "not liking" and "never touching"
> 
Shell scripts are fine, unless you set IFS perversely. 

It's make-files that require tabs and fail confusingly if you have
spaces. Except for GNU-make aka gmake which does the intuitive thing.
(Well, as much as any handcodable 'make' can be intuitive. <G>)

- formerly david.thompson1 || achar(64) || worldnet.att.net
0
David
9/7/2008 4:41:12 AM
Reply:

Similar Artilces:

python is a python
python is a python ...

python and s-lang
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I was just wondering if anyone has looked into using Python instead of, or in additon to, s-lang modules. Does slrn support the use of other interpreted languages ? (I hate the term scripted languages; very innacurate of modern interpreted languages). Given the fact that Python is as flexible and powerful as it is, and given the fact that it was designed to interface with such languages as C, it seemed natural that someone must have done this if it is possible. I would like to hear from those individuals, or anyone with programming experience (a...

best .lang. python
Any ideas on what to do? Stop attempting to negotiate. Contact your state insurance commission. Be prepared to divulge the name of your insurer. Keep detailed records of all your contacts. ----- - gpsman website--> http://www.win2job.info/ ...

Python to Python communication
Hello, I have a group of Python programms which I want to teach to "talk to each other". All run on Windows, on the same computer or in the same intranet. Security of communication is not an issue (encryption on lower level protocols / intra computer communication). Partially these programs are using wxPython. It is important that the communcation is "only an added feature", I am not willing to spend big memory / computing ressources on it. So I googled and came up with at least the following opportunities: XMLRPC - quite "simple" to implement within py...

APL In 2020
Given that we all want APL to be a success, maybe we need to define what we want to be successful at - so that we can better direct our thoughts... I'll offer a three-part division, because I think that the aims and needs are different (even though like most classifications there are counterexamples and overlaps). [0] "APL As A Tool Of Thought" - where the strengths lie in functional richness, array orientation and that simple evaluation rule. Users are their own programmers. Examples from the past would include Chaitin's Mathematical Physics papers. [1] &quo...

Embedding Python in Python
Hi, I've been programming in Python for a couple of weeks now and am quite impressed with the language - it was very easy to learn (it actually reminds me a lot of programming in BASIC many many years ago - it's very fast to hack together a couple lines of code in interactive mode). I'm throwing together a simple little game (sort of a MUD-type thing) as my first 'big' project, and I thought it would be cool to be able to script the game in Python. Basically, I want to be able to type scripts in from within the game and attach them to objects, monsters, rooms, whatever. N...

Invoking Python from Python
Hi all, I have a need to create a Python script on the fly from another Python program and then execute the script so created. Do I need to invoke Python through os.spawnl or is there a better way? Thanks, -- John Am Tue, 08 Nov 2005 08:10:25 -0800 schrieb John Henry: > Hi all, > > I have a need to create a Python script on the fly from another Python > program and then execute the script so created. Do I need to invoke > Python through os.spawnl or is there a better way? Hi, creating source code with a script, is no good solution. Once I had to maintain lisp code w...

Python mascot? How about a Pythoneer?
I've been thinking that a good Python mascot might help in raising public awareness of Python. The problem with a snake as a mascot is that it is not anthropomorphic enough. An effective mascot has to have something approximating two arms, two legs, and a head, so that he can be put into various interesting situations and adventures. (At the very least, he has to be able to work a keyboard and a mouse!) Good examples can be found in some of the imaginative things that have been done with Linux's Tux. So a snake is out. So are Terry Gilliam's wonderful cartoons for the Flyin...

2008 computer new lang-python
thia is new ode adbbfy hsadhj http://www.freewebs.com/thuiss/ http://indianfriendfinder.com/go/g906725-pmem ...

ironpython (.net python) and dynamic langs on CLR
This might interest some of you :) A (fast) python implementation targeting .net and Mono has been released as open source today. Apparently this was announced at OSCON today. If anyone attended the talk I would be interested in hearing about it. I've been waiting for this for a while, not because I program in python but because it's supposed to have some good solutions for implementing dynamic languages on the CLR. Interestingly the author, Jim Hugunin, is going to join the CLR team at Microsoft and he (quote from website:) "will also reach out to other languages to help overcome...

A Lange & Sohne Lange Double Split
A Lange & Sohne Lange Double Split - A Lange & Sohne Watches Discount A Lange & Sohne Lange Double Split: http://www.fashion163.com/A_Lange_Sohne_Lange_Double_Split.html Luxury Watches Lower Prices: http://www.fashion163.com/ Quality A Lange & Sohne Watches http://www.fashion163.com/a_lange_sohne.html We guarantee our A Lange & Sohne Lange Double Split and A Lange & Sohne Lange Double Split aren't just a simple imitation. We use the same fine materials and technology that the original does. Each A Lange & Sohne Lange Double Split produced is examined careful...

Python in the enterprise: "Python Slithers into Systems" / Why Python? (eweek 2007)
Last summers box office hit "snakes on a plane" was the unlikely story of a batch of snakes getting loose in flight on a 747. In what some might view as just as unlikely, ITA Software is using the Python language to empower its airline reservation system. Many computer language purists say that languages such as Java, C++ or C should be used for enterprise applications. However, ITA, a Cambridge, Mass., provider of airline IT software and services, is proving that dynamic languages such as Python can be rock-solid for enterprise work. Indeed, ITA in September 2006 a...

Re: Python mascot? How about a Pythoneer?
Stephen Ferg <steve@ferg.org> wrote: > > I've been thinking that a good Python mascot might help in raising > public awareness of Python. > > The problem with a snake as a mascot is that it is not > anthropomorphic > enough....so a snake is out. > > So are Terry Gilliam's wonderful cartoons for the Flying Circus. > While wonderful, I just don't think they lend themselves to > mascot-hood. > > In that spirit, I propose the development of a figure representing > Python -- the Pythoneer. Given that Python users are traditionally ...

Python script to install python
I would like to have a python script that would download the most recent svn of python, configure, make, install and cleanup after itself. I am not replacing the python version I would be using to run the script. I was struggling to get this to work and I assume someone else has done it better. Any pointers? Thanks Vincent ...

python QT or python-GTK
** All the posts found in google are old. I'm assuming new improvements have been made to both IDEs. ** Please correct me if I'm wrong, I'm a newbie. 1. Which one of them requires fewer lines to accomplish the same thing? from what I understand QT it's just like Borland J-Builder. Meaning, you want a button, you draw it, then you double-click on it, a window opens up and you type events and behavior. And with GTK, you just type everything. 2. Which one is cross platform? (Linux, MacOS, Windows,etc). 3. Which one has more widgets? 4. Which one is the easiest to pick up? I...

Web resources about - Python - comp.lang.apl

Python - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Woman bitten on the nose by python during snake show in Phuket
Video of a python that suddenly attacked a Chinese tourist at a snake show on the resort island of Phuket has spread quickly across Thailand's ...

Woman bitten on the nose by python during snake show in Phuket
Video of a python that suddenly attacked a Chinese tourist at a snake show on the resort island of Phuket has spread quickly across Thailand's ...

Woman bitten on the nose by python during snake show in Phuket
Video of a python that suddenly attacked a Chinese tourist at a snake show on the resort island of Phuket has spread quickly across Thailand's ...

Woman bitten on the nose by python during snake show in Phuket
Video of a python that suddenly attacked a Chinese tourist at a snake show on the resort island of Phuket has spread quickly across Thailand's ...

Woman bitten on the nose by python during snake show in Phuket
Video of a python that suddenly attacked a Chinese tourist at a snake show on the resort island of Phuket has spread quickly across Thailand's ...

Buster the puppy lucky to be alive after tussle with python on Sunshine Coast
A puppy named Buster is lucky to be alive after a python latched on to its jaw and tried to strangle the dog to death.

The great 2016 Florida Python hunt is underway
State's first public hunt in 2013 for the invasive Burmese Python snake, which can grow up to 18 feet, did little to curb growing problem

Florida issues 'Python Challenge' to combat invasive snake - CNN.com
The Burmese python, one of the largest snakes in the world, is running amok in Florida.

Man Caught On Camera In Pet Store Shoving Python Down Pants
... his pants . Last week in Portland, OR, a pet store’s surveillance cameras caught a man on camera who used this method to conceal a pricey python ...

Resources last updated: 2/8/2016 8:19:51 AM