Re: Euphoria v.s. Python
- Posted by JJProg at CYBERBURY.NET Feb 23, 1999
- 463 views
EU>> EU>>Hi, EU>> EU>>I came across with another interpreted language called "Python". EU>>The description reads that it is oop, it has versions available EU>>in Mac, DOS, Win 3.1, Win 95, Linux, many flavors of Unix and others. EU>>It has support for Sybase, Informix, Oracle. Also ODBC and SQL. EU>> EU>>Has anyone tried Python? How is Euphoria better than Python? I downloaded Python yesterday, learned most of it today, and I've concluded that Python has a lot of neat features, but is severely lacking in several areas. Python has support for many things that would be very nice to have in Euphoria, including: complex numbers packages better sequence indexing (Python, for example, can automatically make a slice go from index i to the end of the sequence like so: seq[i:]) ability to assign a list of values to a list of values and other neat features, for example: a = b = 0 a, b = 0, 1 [a,b,c] = [1,2,3] object-oriented programming (I haven't explored this yet, but I know it's there; it's in the manual) But Python also has many bad things about it, including: no editor that comes with the language (just a scary interactive interperter so you can either have it run a file or execute what you type in, as you type it in, but no way to save it, and no syntax hilighting, auto-indenting, auto-completion etc.) very slow (sieve.ex gets thousands of sieves per second, while my Python version gets about 75 on my P233MMX with 48MB RAM and Win98) bad structure (functions and procedures both defined with def keyword, there are several different types of sequences utilizing ()'s, {}'s, and []'s, and no changing characters in a string like string[1] = 's'), no end statements. Here is my sieve.py program so you can see examples of the bad structure: import time import sys BATCH = 50 BENCH_TIME = 15 SIZE = 500 ON = 1 OFF = 0 def sieve(): count = 0 flags = [] for i in range(SIZE): flags.append(ON) for i in range(SIZE): if flags[i] == ON: prime = 2 * (i+1) prime = prime + 1 start = prime + (i+1) for k in range(start-1,SIZE,prime): flags[k] = OFF count = count + 1 return count print "prime sieve benchmark ..." cycles = 0 t = time.clock() while time.clock() < t + BENCH_TIME: for iter in range(BATCH): if sieve() != 167: print "whoops!" sys.exit() cycles = cycles + BATCH t = time.clock() - t print cycles/t," sieves per second" Note: doesn't display the actual primes, but that doesn't change the speed. Then again, you can do neat things like: a = complex(5,4) # (this is a Python comment) a = 5 + 4i (a complex number) for elements in sequence: # (no for i = 1 to x, but there are ways of doing that... see my program above) # do whatever # the following is an example of a hashtable languages = [] languages["Euphoria"] = "good" languages["Basic"] = "bad" languages["Python"] = "ugly" Python also provides an enormous number of other neat things, too long to explain them all here. In conclusion, Python is great for some things, but terrible for others. The interactive interperter makes a cool calculator... Jeffrey Fielding JJProg at cyberbury.net http://members.tripod.com/~JJProg/