On 9 December 2011 21:44, Steven D'Aprano <st...@pearwood.info> wrote:
> Sarma Tangirala wrote: > > The point is its a scripted language. >> > > Define "scripted language". (Scripting language?) > > > I meant scripting language. :) > > Most of what you want to do should be >> about a line. Python is derived from the idea of scripted languages >> wherein >> constructs like loops and functions were added for more control. >> > > I don't understand what you mean by "should be about a line". If your idea > is that Python is an interpreter that reads the source code line by line, > interpreting then executing each one in turn, you couldn't be more wrong. > Python uses a compiler that generates byte-code, then executes it in a > virtual machine, just like (for example) Java. The CPython compiler and > virtual machine is the reference implementation; the PyPy implementation is > a JIT compiler which can approach the speed of optimized C code, and in a > very few cases, actually beat it. > > Well, what I meant was the way you write things like list comprehension. I agree, that comment gave a completely incorrect picture. Sorry about that. > If Python is a "scripting language", it is a scripting language which can > perform video processing on the fly: > > http://morepypy.blogspot.com/**2011/07/realtime-image-** > processing-in-python.html<http://morepypy.blogspot.com/2011/07/realtime-image-processing-in-python.html> > > > Scripting language not in the true sense. My bad. > > The main >> idea of programming in python is not essentially writing a functions but >> rather like shell scripting, one line of syntax at a time. >> > > I can't imagine why you think that is the "main idea" for programming in > Python. Even in true scripting languages like bash, the use of functions is > strongly recommended. For anything but the simplest script, you are better > off encapsulating code into functions or classes. > > Of course Python can be used to write simple scripts without functions. > And complex scripts with functions. And "glue" code to interface between > libraries written in C or Fortran. And major applications with tens or > hundreds of thousands of lines of code, dozens of modules, hundreds of > classes and functions. And everything in between. > > > I disagree here. Writing bigger pieces of code warrant the use of functions not the other way around. What I was trying to say was that in C you'd have to use a main function and in Java a public class in your code. In python it is not a business of using functions as the OP had mentioned. As to the "main idea", I think I could have worded that a bit better. I'm really sorry if what I posed before was annoying crap. :) > > -- > Steven > > > ______________________________**_________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor> > -- Sarma Tangirala, Class of 2012, Department of Information Science and Technology, College of Engineering Guindy - Anna University
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor