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

Go to work

Name: Anonymous 2011-10-19 13:03

If someone added braces, switches, static and private, protected, ... to Python I would use it.

Name: Anonymous 2011-10-19 13:06

But I don't have a job, OP.

Name: Anonymous 2011-10-19 13:08

>>2
You do now, start working on Python++.

Name: Anonymous 2011-10-19 13:12

python is already perfect, fagstorm

Name: Anonymous 2011-10-19 13:19

But Python already has braces:

import sys
from __future__ import braces
def main(argc, argv):#{
    if(23/20):#{
        print("look, braces and other C stuff");
    #}
#}
main(len(sys.argv), sys.argv);

Name: Anonymous 2011-10-19 14:11

>using a non-turing complete language for programming

if it ain't lisp, it ain't lisp

Name: Anonymous 2011-10-19 14:11

frome __future__ import parentheses

Name: Anonymous 2011-10-19 15:07

from __geography__ import frome

Name: Anonymous 2011-10-19 15:57

from __anus__ import hax

Name: Anonymous 2011-10-19 17:06

static - declare outside class
private - dont use it
protected - dont use it unless u mean to

Name: Anonymous 2011-10-19 17:08

Python already has switch:

import re

def indent(line):
    return len(line) - len(line.lstrip(' '))

class switch:
    def __init__(self, arg):
        self.arg = arg
    def __call__(self, code):
        code = code.split('\n')[1:-1]
        case_indent = indent(code[0])
        code_indent = indent(code[-1])
        cases = {}; current = None
        for i in code:
            if indent(i) == case_indent:
                if i[case_indent:] == 'else:':
                    current = None
                else:
                    m = re.match(r'case (.*)\.\.(.*):', i[case_indent:])
                    if m:
                        current = xrange(eval(m.group(1)), eval(m.group(2)))
                    else:
                        m = re.match(r'\s*case (.*):', i)
                        current = eval(m.group(1))
                        if type(current) != tuple:
                            current = (current,)
            elif indent(i) == code_indent:
                cases.setdefault(current, []).append(i[code_indent:])
        for k, v in cases.items():
            if k and self.arg in k:
                exec '\n'.join(v) in globals()
                break
        else:
            exec '\n'.join(cases[None]) in globals()
               
def foo(x):
    switch(x) ('''
        case 10..19:
            y = 'ten'
        case 20..29:
            y = 'twenty'
        case 400, 500:
            y = 'cool'
        else:
            y = 'nope'
    ''')
    return y
print foo(500)

Name: Anonymous 2011-10-19 17:20

>>11
My eyes hurt.

Name: Anonymous 2011-10-19 17:21

>>11
I vomited on my keyboard

Name: Anonymous 2011-10-19 17:32

>>11
Python's syntax makes my fucking eyes bleed every time I look at it.

Name: Anonymous 2011-10-19 17:35

>>14
I demand a photo!

Name: Anonymous 2011-10-19 17:46

>>11 No wonder I hate FIOC
Perl is superior:


#!/usr/bin/perl
use Switch;
 switch ($linenum)
    {
    case "45"       { $in =  "$line" ; }
    case "55"       { $out = "$line" ; }
    }

Name: Anonymous 2011-10-19 17:48

>>16
given/when is more fun.

Name: Anonymous 2011-10-19 23:07

Python sucks dick, but the standard library makes it worthy of using. And at least it's relatively readable, unlike Hathkell/Lithp.

Name: Anonymous 2011-10-19 23:16

Python sucks dick
I demand a photo!

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