Mathias Panzenboeck a écrit : > Bruno Desthuilliers wrote: > >>Mathias Panzenboeck a écrit : >> >>>Rob Thorpe wrote: >>> >>> >>>>Mathias Panzenboeck wrote: >>>> >>>> >>>>>Mark Tarver wrote: >>>>> >>>>> >>>>>>How do you compare Python to Lisp? What specific advantages do you >>>>>>think that one has over the other? >>>>>> >>>>>>Note I'm not a Python person and I have no axes to grind here. >>>>>>This is >>>>>>just a question for my general education. >>>>>> >>>>>>Mark >>>>>> >>>>> >>>>>I do not know much about Lisp. What I know is: >>>>>Python is a imperative, object oriented dynamic language with duck >>>>>typing, >>>> >>>>Yes, but Python also supports the functional style to some extent. >>>> >>> >>> >>>I currently visit a course about functional programming at the >>>university of technology vienna: >>>python implements only a small subset of things needed to be called a >>>functional language (list >>>comprehension). >> >>Python has functions as first-class objects (you can pass functions as >>arguments to functions, return functions from functions, and bind >>functions to identifiers), and that's the only thing you need to use a >>functional approach. > > > You mean like function pointers in C and C++?
Absolutely not. Python's functions are normal Python objects, instances of the (builtin) class 'function'. FWIW, any object implementing the __call__ method can behave as a function. Python functions can take functions as arguments, and return functions - this is how 'decorators' work. > I think this should be possible in assembler, too. > I thought functional languages have to be declarative? For what definition of 'declarative' ? > The boost C++ library has even lambdas! So does Python - even if in a restricted way. -- http://mail.python.org/mailman/listinfo/python-list