Python

Dec 15, 2007 04:03

I'm learning python. I've wanted to learn it for a while, but I finally have a purpose, which makes it easier for me. Unless I have a project to work on, I can't really learn anything (as it turns out). So, I've decided to make a python-script for all the statistical calculations required during the course. It will use lists for holding the raw ( Read more... )

Leave a comment

Comments 20

diaryarena December 15 2007, 14:53:55 UTC
http://www.pythonchallenge.com/

http://projecteuler.net/

Be sure to check out the solutions once you've finished a puzzle, on both sites. The fora are full of interesting ideas and idomatic programming. Python is a really excellent language, but some of the idiom is completely unlike other languages.

https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99/

This is good too, python chews up a lot of these problems with language features, but it's still tricky by the end.

also for stats you might want to use numpy, which is ridiculously fast and very pythonic.

Reply


nametakentwice December 15 2007, 19:37:47 UTC
Ryan recommends LISP over Python. Apparently part of Python's protocol works based on whether you indent something 3 spaces versus 4 spaces, making it hella-dangerous and a pain. Other languages tend to use brackets for these things.

Reply

diaryarena December 15 2007, 20:08:00 UTC
I hear that a lot. The thing is, it's important to format your code clearly so that it's easy to read. Python's block terminations are based on indentation so that there's actually LESS ambiguity about what's going on for the reader.

There are post-processors that let you use tradition c-style braces, but it's hackish and pointless.

Also it's not actually "3 vs 4 spaces", it's "is this line indented more or less than the previous line?". You don't have to be consistent.

Reply

nametakentwice December 15 2007, 20:52:21 UTC
Ah. Yeah, that still sounds pretty painful to me. I'd rather have nice logical braces and still format my code clearly, but not have the code freakout if I do miss some indenting or something. But that's me. To each their own. Godspeed, Dave, and make sure you format well (which is a good idea anyway).

Reply

diaryarena December 15 2007, 20:08:19 UTC
Also, ha ha ha lisp.

Reply


diaryarena December 16 2007, 01:10:05 UTC
man I just totally got trolled didn't i

Reply

theflamingpi December 16 2007, 17:09:37 UTC
You did! It was entertaining to read. You should reply with comments to my journal more often.

Reply


Leave a comment

Up