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

Pages: 1-

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''.

Name: Anonymous 2012-02-08 5:21

>>20
Accidentally forgot the space, meant head -n $2.

Name: Anonymous 2012-02-08 5:46

>>19
What exactly do you mean by that?

Name: Anonymous 2012-02-08 5:59

>>20-1
Actually I mean ``head -$2'' but whatever.

Name: Anonymous 2012-02-08 6:14

>>10
ONE WORD THE FORCED VARIABLE DECLARATION FOR LOOPS

Name: Anonymous 2012-02-08 6:30

>>24
It's not like you can't do for _ in iterable.

Name: Anonymous 2012-02-08 6:33

>>25
_ is a variable moron.

Name: Anonymous 2012-02-08 7:50

the classics are always the best. c, lisp, perl, shell motherfuckers

Name: Anonymous 2012-02-08 12:58

>>27
C is undefined shit.
Lisp is shit.
Perl is $hit.
Shell\ is\ fucking\ shit.

Name: translate it from russian 2012-02-08 13:13

в етом ИТТ треде мы выяснили что новомодные анальные игрушки для быдляков ПИСТОН и ХАЧКЕЛЬ
сосут у олдфажных мега языков на все времена C-шки и perl-а все время
---
лучий вариант на ПИСТОНЕ: http://ideone.com/udDJ9
(императивный понос)
2 варианта на ХАЧКЕЛЕ
1.ебаный пиздец во всех смыслах и имеперативное гавнище: http://ideone.com/M42su
(сосет у C-шки)
2. деклашотивное петушение http://ideone.com/0e3qE
(сосет у декларотивного петушения на perl)
---
для сравнения
perl: http://ideone.com/i0ob4 http://ideone.com/olq5B
C: http://ideone.com/ap43H
LUA: http://ideone.com/DVdhr http://ideone.com/Xkj4D
---
http://ideone.com/6cZYq лисп как и ожидалось сонул, ну и возможно ответ неправильный
(какието черезжопные варианты с 33 кратной вложеностю скобок быле побыстрее но натая хуйне никому не сдалась когда есть простое и самое быстрое решение на C-шке)

Name: Anonymous 2012-02-08 14:24

>>26
no it isn't

lrn2python, ``rubyfag''

Name: Anonymous 2012-02-08 14:41

>>28
Then what is good, motherfucker?

Name: Anonymous 2012-02-08 14:53

>>31

don't listen to that nerd, i bet he uses d

Name: Anonymous 2012-02-08 16:25

I consider myself decent in Ruby and Python, but I can't decide on which framework to use, Ruby on Rails or Django?

Name: Anonymous 2012-02-08 19:28

python is clearly superior to bash, thus superior to ruby
rsh does not stand for ruby shell

>>10 randomline.py

time ./randomline.py tmpcat 10
scoped_refptr<Flag> flag_;
kei1s
CK_RV crv = CKR_SESSION_HANDLE_INVALID;
ri2s1emb
.he4t6s5
r3st4il
tersc4h
}
return _cairo_pdf_operators_emit_stroke (pdf_operators,
pkix_SignatureCheckerState_Create(

real    0m0.393s
user    0m0.324s
sys    0m0.068s

>>15 randomline2.py

time ./randomline2.py tmpcat 10
(dataCentralDir, "generalName/altNameRfc822Cert_diff", plContext);
(((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
point += tmp;
1t1a2da1ta
}
{ "-finpoints",   ".finpoints",   XrmoptionSepArg, 0 },
}
}
{
}

real    0m0.357s
user    0m0.240s
sys    0m0.112s

>>18 [b]randomline.sh[/code]

time ./randomline.sh tmpcat  10
"6DDC39E6FA18B16FCB2E934C9A5F844DAD60EE3B1EA82199EC5E9608F67F860FB965"
    gcv.foreground = st->default_bg_pixel;
��E>J#����E�04h\F/t<R0�<P?�'���<4"�F/�<R2'���5�F5%�F51nG5=�G5�G��<�<�<�0!��<��i<�3bin<�ZT�<����<��>���~�<;(25�J?�H3�0����<��14�0�H2����5�0�H5�0�I@�05�0�I.��<��14�DJE�1�<�4�jJ?�����<�2����@�C�>
       2�~�@?��~�<Q
                        2�~�51K>���
                                      �hK^24��K/�>�5�-LA�
    if (rv == -1 && errno == EINTR) {
curry/DSMG
curry/DSMG
fd_set rd;
  m->y = m->starty;
  m->y = m->starty;
    if (procParams != NULL)

real    2m40.266s
user    2m39.878s
sys    0m0.084s

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