Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

PYTHON vs. RUBY

Name: Anonymous 2012-02-07 21:28

Python vs. Ruby

Which one is best?

Name: Anonymous 2012-02-07 21:49

Non-sexp Lisp.

Name: Anonymous 2012-02-07 23:28

perl

Name: Anonymous 2012-02-08 1:00

Ruby. Allows you to get away with pretty much anything

Name: Anonymous 2012-02-08 1:05

neither is objectively better

Name: Anonymous 2012-02-08 1:12

I prefer Ruby. But they're both fine languages in their own right when applied correctly.

Name: Anonymous 2012-02-08 1:32

Ruby is for faggots.

Name: Anonymous 2012-02-08 2:01

Ruby is fucking awful. The only thing it's notable for is being created by a Jap and adopted by brogrammers as the hipster alternative to PHP. If it was created by an old white guy, nobody would use it.

Name: Anonymous 2012-02-08 2:07

>>8
implying the white guy has done any successful programming language

Name: Anonymous 2012-02-08 3:28

write this shorter in ruby or python

#!/usr/bin/env python
## usage: randomline.py file numlines
from sys import argv
import random
f=open(argv[1])
line=f.readlines()
f.close()
try: c = int(argv[2])
except: c = 1
for q in range(c):  print (line[random.randint(0,len(line))-1]).strip()

Name: Anonymous 2012-02-08 3:45

>>12 is wrong

Name: Anonymous 2012-02-08 3:46

>>10
You can do that in half the lines with perl

Name: Anonymous 2012-02-08 3:48

>>10
You can do that in half the lines with perl

Name: Anonymous 2012-02-08 3:50

Name: Anonymous 2012-02-08 4:22

>>10
import sys, random
print '\n'.join(l.strip() for l in random.sample(open(sys.argv[1]).readlines(), int(sys.argv[2])))

Name: Anonymous 2012-02-08 4:36

>>10
puts File.read(ARGV[0]).sort_by { rand }[0, ARGV[1].to_i].map(&:strip)

Name: Anonymous 2012-02-08 4:37

>>16:1:in `<main>': undefined method `sort_by' for #<String:0x80575e4> (NoMethodError)

Name: Anonymous 2012-02-08 4:41

#!/bin/sh
sort -R $1 | head $2

Name: Anonymous 2012-02-08 5:06

>>17
Lrn2ruby1.9

Name: Anonymous 2012-02-08 5:20

>>18
You mean ``head-n $2''.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List