Eric,

I am not sure this is the place for this type of discussions. I would
recommend this mailing list instead.

    http://mail.python.org/mailman/listinfo/tutor

Of course your questions are welcome here but there you will find more
people interested in general python programming. Here users tend to be
more focused on web development issues. In web development you tend to
avoid as much as possible loops and recursion because we are
interested in speed.

Massimo




On Jul 10, 6:45 pm, eric cs <[email protected]> wrote:
> COOL...can you post some examples explaining what it does line by
> line?
>
> what about an example of:
> Concurrent programming encompasses the programming languages and
> algorithms used to implement concurrent systems. Concurrent
> programming is usually considered to be more general than parallel
> programming because it can involve arbitrary and dynamic patterns of
> communication and interaction, whereas parallel systems generally have
> a predefined and well-structured communications pattern. The base
> goals of concurrent programming include correctness, performance and
> robustness. Concurrent systems such as operating systems are generally
> designed to operate indefinitely and not terminate unexpectedly. Some
> concurrent systems implement a form of transparent concurrency, in
> which concurrent computational entities may compete for and share a
> single resource, but the complexities of this competition and sharing
> are shielded from the programmer.
>
> Because they use shared resources, concurrent systems in general
> require the inclusion of some kind of arbiter somewhere in their
> implementation (often in the underlying hardware), to control access
> to those resources. The use of arbiters introduces the possibility of
> indeterminacy in concurrent computation which has major implications
> for practice including correctness and performance. For example
> arbitration introduces unbounded nondeterminism which raises issues
> with model checking because it causes explosion in the state space and
> can even cause models to have an infinite number of states.
>
> On Jul 10, 6:54 pm, rb <[email protected]> wrote:
>
> > A recursive "loop" is effected by using a function (let's call it
> > "myFunc") which has two return points, one which calls itself and digs
> > deeper (eg "return myFunc(some, modified, args)") and the other which
> > unwinds the digging and returns (eg. "return (value)").
>
> > Thus if calling myFunc many times (via the first return point of the
> > func) One incurs the cost of setting up the local variables and
> > storing the return point on the return stack. When the func unwinds it
> > then must deallocate the local stack back to the system. Simple
> > iterative looping does not have this overhead. Python, being a high-
> > level interpreted language, probably has considerable overhead for
> > setting up the local stack for a func to run (compared to something
> > like C). Unwinding recursive loops into iterative loops always aids
> > performance.
>
> > The (only) reason to use recursion is to express an algorithm in the
> > most elegant terms. For example, consider an algorithm which is
> > defined in recursive terms like the Fibonacci series. Using recursion
> > to determine the nth Fibonacci number is quite natural. However,
> > coding loops into recursion for no other reason than, the language
> > doesn't have iterative loops, or simply because you CAN do it, is an
> > exercise in obfuscation.
>
> > Oh, another issue to watch out for when looping recursively is that a
> > return address gets pushed onto the return stack for every loop
> > iteration. If you loop one too many times and blow your stack (overrun
> > the stack) you have just borked your system. While your mileage may
> > vary, from a BSOD to a nasty worded MessageBox from the OS, still, it
> > is definitely something which "is NOT a good thing."
>
> > --
> > my 3 cents.
>
> > Rb.
>
> > On Jul 10, 2:19 pm, eric cs <[email protected]> wrote:
>
> > > They compare Ruby 1.9 with Python, than a Python guy change the
> > > algorithm from being recursive to being iterative and runs way
> > > faster...wow.
>
> > > Can you guys explain those ways of programming with simple examples
> > > with comments?
> > > I heard is very used on functional programming (Erlang,Scala).
> > > How to iterative program in Python and Web2py?
>
> > >http://antoniocangiano.com/2007/11/28/holy-shmoly-ruby-19-smokes-pyth...
>
> > >http://www.mysoftparade.com/blog/ruby-19-doesnt-smoke-python-away/
>
> > > Thanks.
>
> > > more:http://en.wikipedia.org/wiki/Iteration-Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to