[Tutor] function declaration problems perhaps?

nibudh nibudh at gmail.com
Wed Jul 25 16:05:38 CEST 2007


Hi Kent and Alan,

Thanks for the responses. It really got me thinking!

To test what i thought i knew, i wrote a "hello world" script in perl and
python.

in perl this works:

#!/usr/bin/env perl
hello("World");

sub hello {
    print "Hello ". $_[0] . "\n";
}

but in python:

#!/usr/bin/env python
hello('World')

def hello(name):
    print "Hello" + name

That doesn't.

I have a vague recollection that ASP works in a similar way to python hence
the "hunch" i had earlier but i could be wrong. It's been a while since i've
done programming.

I can see how the property of being executable (defs and imports) could be
handy, but right now I'm still getting to grips with the language proper.

Thanks again for the explanations and I'll keep them in mind as i experiment
some more with python.

nibudh.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070726/d5135979/attachment.htm 


More information about the Tutor mailing list