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

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 15 2007, 20:21:05 UTC
Seriously, though, you have no idea how frustrating this is to hear, this sort of FUD.

It's like saying "WHAT IF YOU FORGET A PARENTHESIS (in lisp) OR SEMICOLON (in c) OR ENDIF (in ruby)".

You know what happens if you forget a semicolon in C? The compiler barfs and you find the TYPO and FIX IT.

Funnily enough, no one ever says "hey, it really sucks you how can't accidentally assign a value in a python if-statement because the language doesn't allow it".

Reply

nametakentwice December 15 2007, 20:53:39 UTC
Does python barf if you mess up the spacing?

Reply

theflamingpi December 15 2007, 21:09:42 UTC

dave@kryten:~$ python heightofclass.py
File "heightofclass.py", line 14
if not in_line:
^
IndentationError: unindent does not match any outer indentation level
dave@kryten:~$

Not nearly as bad as C.

Reply

That was sarcasm akizeta December 15 2007, 21:49:51 UTC
doubly so for my recommendations of lisp.

Lisp fanatics are almost as bad as python fanatics, who are nearly as bad as mac fanbois

Reply

Re: That was sarcasm theflamingpi December 16 2007, 17:12:00 UTC
Yeah. I've heard crappy things about LISP. Of course, emacs is built with lisp, but what else is?

I thought about Perl for a while, but decided against it. Perl looks overly complicated.

I chose python for two reasons:

1) diaryarena recommended it a long while ago.
2) http://xkcd.com/353/

Reply

Re: That was sarcasm akizeta December 17 2007, 18:25:07 UTC
How many RussianJournal accounts do you have ( ... )

Reply

Re: That was sarcasm theflamingpi December 20 2007, 04:24:24 UTC
Well, I have no way of knowing for sure whether I like lisp, perl, or anything, really. I'm not a programmer. I don't know any programming languages, though it could be argued that LaTeX is a (meta-) language. Therefore, anything I say about Perl or Lisp is heresay ( ... )

Reply

Re: That was sarcasm akizeta December 20 2007, 14:05:28 UTC
> Well, I have no way of knowing for sure whether I like lisp, perl, or anything, really. I'm not a programmer. I don't know any programming languages, though it could be argued that LaTeX is a (meta-) language. Therefore, anything I say about Perl or Lisp is heresay ( ... )

Reply

Re: That was sarcasm theflamingpi December 20 2007, 16:40:55 UTC
Regular expressions?! Interrobang!?

http://xkcd.com/208/

Reply

Re: That was sarcasm nametakentwice December 22 2007, 07:38:28 UTC
Ooh, ooh, I can field this one.

http://en.wikipedia.org/wiki/Regular_expressions

Huzzah! MISSION ACCOMPLISHED! Please take my caps in lieu of a giant banner on a battleship.

Basically it's a formulaic way of looking at language/text, which is handy for when you're looking for something specific, i.e. string matching, as mentioned above.

Reply

Re: That was sarcasm theflamingpi December 22 2007, 18:38:23 UTC
You know, wikipedia isn't a good source for citing. There is a 14 year-old kid in Alberta who is an official moderator. That just screams "flawed". Therefore, I only cite xkcd, because it is the only website on the net we can trust.

Reply

Re: That was sarcasm nametakentwice December 22 2007, 19:04:41 UTC
Blah blah blah.

Unless you're doing a fancy, hardcore, academic paper, I find Wikipedia is actually pretty good for information. Sure, there are probably some topics that should be avoided, like anything a company would pay for to help their image, but it's handy for a lot of stuff. I used it to fine results on a history essay recently, since I wasn't going hardcore with it or anything, and Wikipedia tends to be particularly useful for info on comic books or technology.

Especially in this case, it's a freakin' definition of a technical practice.

Besides which, I wasn't 'citing', comments on a livejournal aren't exactly an academic paper. Besides, if you want more info or don't trust wikipedia, then just google something else.

Plus, you sir are an age-ist. Maybe this 14 year old is very bright. Just cause someone is old doesn't mean they're competent.

Reply


Leave a comment

Up