On Fri, Jul 27, 2012 at 4:01 AM, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: > On Thu, 26 Jul 2012 19:42:11 +1000, Chris Angelico <ros...@gmail.com> > declaimed the following in gmane.comp.python.general: > >> Well, if/while/for could be functions. So could with, probably. Now, >> def would be a little tricky... >> > And how would a function "if" perform
It'd be much more similar to the ternary operator. Currently there's no way to pass an unevaluated expression to a Python function, but the concept isn't impossible. It's just more suited to functional languages (someone mentioned Haskell) than to imperative ones. > Now, how does the language differentiate between a loop and an if? > > if(conditional): > do something and continue with next statement > > turns into > True: > do something and continue with next statement > > while > > while(conditional): > do something and go back to the test > > turns into > True: > do something and go back to the test Oh THAT's easily solved. A while loop is an if with a goto! Okay, was that sufficiently incendiary? Have fun! :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list