Python is perfection

Pic is a fully functioning spelling corrector. Look at that beauty, simplicity and elegance.

Examples:
>>> correction('speling')
'spelling'

>>> correction('korrectud')
'corrected'

Bow to the power of the snake, python haters.

Attached: âdasdasd.jpg (775x687, 127.78K)

Other urls found in this thread:

docs.python-guide.org/writing/gotchas/
twitter.com/SFWRedditGifs

It wouldn't look worse in lisp

>using python's open() wrong
lol

I'm sure Peter Norvig needs feedback from you, user.

yeah, he should end up with unclosed handles at least

no, a file is iterable

When you use sum(WORDS.values()) as a default argument in P, is that cached after the first usage or recalculated every time P is called without an N argument?

you will learn just how "iterable" it is when it's big enough. Python is slow enough to show you by example

also reading to the end doesn't automatically destroy the handle or anything. since it's 100% that you can still seek() it back

>using the worst def names possible
>using single letter def name
>LUK AT DUH ELLEGENSE
it's not elegant if your code looks like completely shit

once, when the function is defined.
see: docs.python-guide.org/writing/gotchas/

This doesn't conform to PEP8, does it?

Python will close it for you, do you think this is c you retard?

Functional programming is nice for this.
Python tried it.

If you consider solving memory leaks (open() is resource acquisition) by exit as automatic. Firefox done this for many years, nobody complained much. Right?

do it lispfag

this program is meant to run and close quickly not remain open indefinitely
99% of C implementations of same program will just de allocate at the end

>ython will close it for you
should've used a context manager retard
with open("anime.txt") as f:
f = f.readlines()

how would it look in fp?

Yep, you imply that your program will not grow, hence both functional style and not freeing your resources.

I didnt write the program retard. Im just spitting facts.

with open('urgay.txt') as f:
lines = [line.strip() for line in f]