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

Python 3 sucks

Name: Anonymous 2009-01-12 14:10

The third version of FIOC ( Python3000 for you cheese lovers ) is kind of lame, even lamer than classic FIOC. Minor changes suck and bigger ones weren't necessary.

Name: Anonymous 2010-04-20 21:39

Question for >>- (I couldn't be bothered picking out the relevant posts)

How do you expect to do code such as the following:1
def median(a, b):
    return int((a + b) / 2)

def foo(a, b):
    m = median(a, b)
    if m != a != b:
        return [a] + bar(m, b)
    return list(range(a, m))

def bar(a, b):
    m = median(a, b)
    if m != a != b:
       return foo(a, m) + [b]
    return list(range(m, b))

print(bar(0, 20))


Without some way of being able to reference variables which have not yet been assigned in the scope? If you had to forward declare every function that hasn't been defined yet, you might as well be writing header files and using C.

This isn't something unique to Python, either. Perl does exactly the same thing:
sub a {
    return b($in_a, @_);
}
sub b {
    print($in_b, "@_\n");
}
$in_a = "in a:";
$in_b = "in b:";
$, = " ";
a(1, 2, 3);


While it can be counterintuitive at times, the reasons behind this behavior are completely sound, and you likely rely on it much more often than you might think.


1. Yes, these examples are rather contrived, but they're meant not to demonstrate practicality so much as to get the point across succinctly. If this bothers you, pretend I wrote a full recursive descent parser.

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