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

Python

Name: Anonymous 2010-07-13 21:02

How good is Python?

Name: Anonymous 2010-07-14 10:04

If by good you mean that you can't have function to modify a passed parameter, then yes.
If by good you mean it's limiting you and treating like a baby with its dumb syntax, then yes.

And for the HERP DERP UGLY PERL

Example code in Perl 5 (Moose example on their webpage):
package Point;
use Moose;

has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'Int');

sub clear {
    my $self = shift;
    $self->x(0);
    $self->y(0);
}

package Point3D;
use Moose;

extends 'Point';

has 'z' => (is => 'rw', isa => 'Int');

after 'clear' => sub {
    my $self = shift;
    $self->z(0);
};


Oh god! So ugly and unreadable! Let's see python now. Let's see the first exapmle from Dive Into Python:
def buildConnectionString(params):
    """Build a connection string from a dictionary of parameters.

    Returns string."""
    return ";".join(["%s=%s" % (k, v) for k, v in params.items()])

if __name__ == "__main__":
    myParams = {"server":"mpilgrim", \
                "database":"master", \
                "uid":"sa", \
                "pwd":"secret" \
                }
    print buildConnectionString(myParams)

YEAH! So readable and straightforward, so much better than syntax-ugly Perl. Isn't it?

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