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

Python sucks

Name: Anonymous 2011-05-19 22:57

``If you can do exactly what you want with Python 3.x, great! There's a few downsides, such as comparatively limited library support and the fact that current Linux distributions and Macs are still shipping with 2.x by default, but as a language Python 3.x is definitely ready." - Python Official Website

They really go out of their way to try and apologize for a shitty language.  3.x is awful and NO ONE will ever adopt it.  Python is going to die when 2.7 becomes too old to be useful since Python is just a novelty language that represent an idea that will actually be polished and efficient at some point down the road.

Name: good night sweet prince 2011-05-19 23:01

Google says JavaScript is a new Python.

Name: Anonymous 2011-05-19 23:03

Python does suck, it definitely will die, but that's just stupid. It's the same thing of ``WinVista sucks, it's awful and NO ONE will ever adopt it. Windows is going to die when WinXP becomes too old to be useful''. I still have to see the year of the Linux desktop.

Name: Anonymous 2011-05-19 23:08

>>3
The point is: Linux is no better than Windows - both are shitty Unix-clones.

Name: Anonymous 2011-05-19 23:29

>>4
The point is: Windows is still alive.

Name: Anonymous 2011-05-19 23:43

>>5
"That's not a bug, that's a feature!"

Name: Anonymous 2011-05-20 21:05

Lisp

uniq L -> L,sort,{[@A X X @B]->[@A @[X @B],r]; E->E}


Python

a=[1,4,6,3,4,5,6,6,7,7,9,9,4,3,4,7,7,7,4,3,5,7,3,6,3,]
print a
 
def removeDoubles(a):
  nonD=range(len(a))
  for i in range(len(a)):
    for j in range(i+1,len(a)):
      if a[i]==a[j]:
        nonD.remove(i)
        break
  b=[]
  for i in nonD:
    b.append(a[i])
  return b
 
def removeDoubles2(a):
  #b=sorted(a)
  def quickSort(a):
    def qSort(i,j):
      global a
      if j==i:
        return
      elif j-i==1:
        if a[i]>a[j]:
          c=a[j]
          a[j]=a[i]
          a[i]=c
          return
      else:
        l=(j+i)/2
        qSort(i,l)
        qSort(l+1,j)
        join(i,l,j)
        return
    def join(i,l,j):
        global a
        k=i
        n=l+1
        m=0
        s=j
        t=l
        b=range(j-i+1)
        while 1:
          if a[k]<a[n]:
            z=k
            k=n
            n=z
            z=s
            s=t
            t=z
          b[m]=a[n]
          m+=1
          n+=1
          if n>s:
            for g in range(t-k+1):
                b[m+g]=a[k+g]
            break
        for g in range(j-i+1):
          a[i+g]=b[g]
    qSort(0,len(a)-1)
  c=a
  quickSort(c)
  b=[]
  b.append(c[0])
  for i in range(1,len(c)):
    if c[i]>c[i-1]:
      b.append(c[i])
  return b
 
print removeDoubles(a)
print removeDoubles2(a)

Name: Anonymous 2011-05-20 21:05

Lisp:

Grammar -> split '| '(sentence    -> (noun_phrase verb_phrase)
                     |noun_phrase -> (Article Noun)
                     |verb_phrase -> (Verb noun_phrase)
                     |Article     -> the a
                     |Noun        -> man ball woman table
                     |Verb        -> hit took saw liked)

generate =: {[@P]->mapc r P; P:!rewrites->P,rand,r; P->[P]}
rewrites Category -> Grammar,{[@_ [!Category '-> @RHS] @_]->RHS}


Python:

from random import choice

def Dict(**args): return args

grammar = Dict(
        S = [['NP','VP']],
        NP = [['Art', 'N']],
        VP = [['V', 'NP']],
        Art = ['the', 'a'],
        N = ['man', 'ball', 'woman', 'table'],
        V = ['hit', 'took', 'saw', 'liked']
        )

def generate(phrase):
    "Generate a random sentence or phrase"
    if isinstance(phrase, list):
        return mappend(generate, phrase)
    elif phrase in grammar:
        return generate(choice(grammar[phrase]))
    else: return [phrase]
   
def generate_tree(phrase):
    """Generate a random sentence or phrase,
     with a complete parse tree."""
    if isinstance(phrase, list):
        return map(generate_tree, phrase)
    elif phrase in grammar:
        return [phrase] + generate_tree(choice(grammar[phrase]))
    else: return [phrase]

def mappend(fn, list):
    "Append the results of calling fn on each element of list."
    return reduce(lambda x,y: x+y, map(fn, list))

>>> generate('S')
['the', 'man', 'saw', 'the', 'table']

>>> ' '.join(generate('S'))
'the man saw the table'

Name: Anonymous 2011-05-20 21:06

Lisp

react A                     B:(unseenBy A)                 ->
     ;A:[Damage=pos?]       B:[Owner=(enemyOf A)]          -> attack A B
     ;A:[Healer=y? MP=pos?] B:[Hits=pos? Owner=(allyOf A)] -> heal   A B



Python

def magic(dispatch, res):
     def inner(wrapped):
         dispatch.dispatch_map[res] = wrapped
         return dispatch
     return inner
 
def destruct(f):
     def dispatch(*args):
         key = f(*args)
         func = dispatch.dispatch_map[key]
         return func(*args)
     dispatch.dispatch_map = {}
     return dispatch
 
react = destruct(lambda x,y : (x["Unit"], y["Unit"]))
 
@magic(react, ("A","B"))
def react(x, y): return "Attack"
 
@magic(react, ("A","A"))
def react(x, y):  return "Heal"
 
@magic(react, ("B","B"))
def react(x, y):  return "Woot?"
 
A = {"Unit" : "A"}; B = {"Unit" : "B"}
 
print react(A, A)
print react(A, B)
print react(B, B)

Name: Anonymous 2011-05-20 21:07

Lisp: keep f Xs
Python: return [x for x in xs if f(x)]

Name: Anonymous 2011-05-20 21:36

>>7
removeDoubles
What‽ Check 'em!

Name: Anonymous 2011-05-20 21:43

since Python is just a novelty language that represent an idea that will actually be polished

You can't polish a turd, Sonnyboy.

Name: Anonymous 2011-05-20 22:15

>>12
You can't tune a fish, Tunaboy.

Name: Anonymous 2011-05-21 0:35

Lisp

yoba
  -> Ns:["foo" "bar" "baz"]
  -> {-> "$(rand Ns)($([3,rand+1++"$(rand [y n] |> rand Ns :: r)"]
                       | infix "," | fold sconc))"}


C/C++

#include <stdio.h>
#include <stdlib.h>
#define p printf
#define r rand
char*g="foobarbaz";
char*h(){return(g+abs(r()%3)*3);}
int y(int v){for(int a=abs(r()%5)+3;a;z(++v),p(--a?", ":""));}
int z(int v){(r()%3==0&&v<=4||v==0)?p("%.3s(",h()),y(v),p(")"):p("%.3s",h());}
int main(){srand(time(0)),z(0);}



Python:

import sys,random
 
wordsL=3
words=['foo','bar','baz']
maxI=10
maxA=3
 
def shmjak(i):
 j=random.randint(0,wordsL-1)
 sys.stdout.write(words[j])
 if i<=maxI:
  k=random.randint(0,maxA)
  sys.stdout.write('(')
  for m in range(k-1):
   shmjak(i+1)
   sys.stdout.write(',')
  shmjak(i+1)
  sys.stdout.write(')')
 
shmjak(0)

Name: Anonymous 2011-05-21 0:42

>>1
Cool story, bro.

Name: Anonymous 2011-05-21 1:13

python is the future of programming

Name: Anonymous 2011-05-21 1:13

>>15
I see your retard.

Name: Anonymous 2011-05-21 1:26

>>16
from __future__ import python
  File "/
prog/", line 1
SyntaxError: not a chance

Name: Anonymous 2011-05-21 1:47

>>7-10,14

That doesn't look like Lisp.

Name: Anonymous 2011-05-21 1:53

>>19
Yeah, because the faggot implemented a DSL and just so happened to "forget" to include the code.

So, faggot, try again.

Name: Anonymous 2011-05-21 1:54

>>20
He released the code.

Name: Anonymous 2011-05-21 2:14

>>7

a=[1,4,6,3,4,5,6,6,7,7,9,9,4,3,4,7,7,7,4,3,5,7,3,6,3,]

print a

print list(set(a))


IHBT

Name: Anonymous 2011-05-21 2:41

>>7,22
You shouldn't use the standard library.

Name: Anonymous 2011-05-21 5:32

What does E->E do?

Name: Anonymous 2011-05-21 12:57

Even if you hate Python, unfortunately it's never going to die. It's embedded in a bunch of scientific programs (such as ChemOffice and PyMOL) and as a result will probably become the next FORTRAN IV, in the same way VB6 is set to become the next COBOL.

I said that and I meant it.

Name: UMH memesmith !gNlkr4vCuc 2011-05-21 15:18

>>25
"The next COBOL" is a buzzword as much as "web scale" or "synergy." In fact there is nothing in the world quite like a cold shower of COBOL spaghettis first thing in the fucking morning after getting a panicked call from sysadmins who can't find their own cocks with their eyes open and their hands untied.

Name: Anonymous 2011-05-21 19:38

>>26
Maybe—but it's no less real. Business programmers will be putting up with VB6 for decades due to its extensive use over the last 15 years. Just like their parents have to put up with COBOL and scientific programmers have to put up with packages written in Fortran. Python 2 has job security beyond your wildest imagining.

Name: Anonymous 2011-05-21 21:22

>>24
identity X -> X rewrites X to X.

Name: Anonymous 2011-05-21 21:24


(defun (x) x)

that is what it does do.

Name: Anonymous 2011-05-21 21:35

>>28
wtf is the point bro

Name: Anonymous 2011-05-21 21:54

>>30
Python is going to die. It's clear as daylight.

Name: Anonymous 2011-05-21 23:50

ok noob here. I know a bit of Lisp but I never saw Lisp coded like that.

>>7
>>8
>>9
>>14

That looks like more with Haskell then Lisp, could you explain me please?

Name: Anonymous 2011-05-21 23:53

>>32
He's a troll.

Name: Anonymous 2011-05-22 0:03

>>33
No troll here

this is the lisp I know, for example: calculates the sqrt(1+x), -1<x<=1
(defun fact (v)
  (cond ((eq v 0) 1)
        (T (* v (fact (- v 1))))
        )
  )

(defun taylor (x)
  (let ((n 1) (num 1) (den 1) (res 1))
    (loop (cond ((eq n 10) (return res))
                (T
                 (setq num (* (expt -1 n) (fact (* 2 n)))
                     den (* (* (- 1 (* 2 n)) (expt (fact n) 2)) (expt 4 n))
                     res (+ res (* (/ num den) (expt x n)))
                     n (+ n 1)
                     )
                 )
                )
          )
    )
  )

I'm just intrigued and I would like to know. Has I said, I'm new, therefore I'm still learning.

Name: Anonymous 2011-05-22 0:06

>>28,29
Assuming g being g : E × E → E,

f : E → E
    x ↦ g(x)

So you're both wrong. E→E doesn't have to be identity.

Name: Anonymous 2011-05-22 0:09

>>32
It's a Lisp dialect. It just has advanced reader macros and allows to omit top level parens.

your example would look as:

defun fact (V)
  cond (V=0 1)
       (y   V*(fact V-1))

Name: Anonymous 2011-05-22 0:11

>>35
`->` has nothing to do with types. It has REFAL's rewriting semantics:
http://en.wikipedia.org/wiki/REFAL

Name: Anonymous 2011-05-22 0:16

>>36
thank you. :)

Name: Anonymous 2011-05-22 0:25

>>34
Not you, but >>7-90,14. You're new, it's different.

So, I'll leave the BBCode table here.
/prog/'s BBCode Table
[b]text[/b] text
[i]text[/i] text
[u]text[/u] text
[o]text[/o] text
[s]text[/s] text
[m]text[/m] text (it is usually used to post Lisp code)
[aa]text[/aa] text (you need the Mona font for this, it is used for sjis art, despite the name)
[sup]text[/sup] text
[sub]text[/sub] text
[code]text[/code] text (if you don't wrap your code in [code][/code]tags, no one will ever care to read it.)
[spoiler]text[/spoiler] text
All of them are nestable.
[quote] is not a tag, this is how you quote:
> text
=>
text
The space after the > is important.

This doesn't work with multiline quotes, you must separate the lines with a [br] tag (you don't close this one):

> line1[br]line2[br]line3
line1
line2
line3


Or use a [o][/o]tag, or any other tag that produces a <span>, like [spoiler][/spoiler]..

> line1[o]
line2
line3[/o]

line1
line2
line3


YOU MUST USE sage IN YOUR EMAIL FIELD, unless you're posting something ``important'' or /prog/ is getting spammed.
Your grammar mustshould be correct. Punctuation, proper capitalization, no abbreviations.
WE ARE NOT THE IMAGEBOARDS. No stupid memes, we don't ``lol'', we don't ``epic win'', we don't ``check 'em'', we don't ``>imply'' things, we don't ``inb4'', etc.

You'll learn more about /prog/ by lurking more and reading old threads. Prefer the second one.

Welcome to /prog/, enjoy your stay.

Name: Anonymous 2011-05-22 0:54

Not you, but >>7-90,14.
No. He isn't.
http://symtadev.blogspot.com/

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