A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/080610.html below:

why python annoys me

why python annoys me why python annoys meBen Wolfson wolfson at uchicago.edu
Sat Apr 21 00:15:09 EDT 2001
In article <3AE0F802.3983C9DB at 01019freenet.de>, "Oliver Korpilla"
<korpo at 01019freenet.de> wrote:


> Haskell Quicksort:
> qsort:: Ord a=> [a] -> [a]
> qsort [] = []
> qsort (x:xs) = [y | y <- xs, y <= x] ++ [x] ++ [y | y <- xs, y > x]

Python Quicksort:

def qsort(L):
    L = list(L)
    if L == []:
	return []
    x, xs = L[0], L[1:]
    return qsort([y for y in xs if y<=x])+[x]+qsort([y for y in xs if y>x])

Though you'd be better off with a list's sort() method, of course.

-- 
Barnabas T. Rumjuggler
Thou hast been called, O Sleep!  The friend of woe,
But 'tis the happy who have called thee so.
 -- Robert Southey

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4