Calling J from Python

Larry Bates larry.bates at websafe.com
Mon Feb 5 12:51:54 EST 2007


Bjoern Schliessmann wrote:
> Gosi wrote:
> 
>> J is in many ways similar to Python.
> 
> The only one I see at the moment is that they're both some kind of
> programming languages.
> 
>> J has very many advanced operations.
> 
> Sure.
> 
> Mh, just looking at some "advanced" J source taken from
> wikipedia.org makes me feel sick:
> 
> | Here's a J program to calculate the average of a list of numbers:
> |    avg=: +/ % #
> |    avg 1 2 3 4
> | 2.5
> 
> In the meantime, do you now have an answer to why we should care?
> 
> Regards,
> 
> 
> Björn
> 
And why is that superior to this:

def avg(l):
    return float(sum(l))/len(l)

>>>avg([1,2,3,4])
2.5


Which can actually be read and debugged in the future!

-Larry



More information about the Python-list mailing list