If we want pass(), then why not break() and continue()? And also def() and class()? for(), while(), if(), with(), we can make them all callable objects!
Except that they are control statements. They are not objects, they have no type, and they can never be evaluated in an expression. And most importantly, there is no value to be gained by making them objects. It is valuable for a language to have control statements, as others have already explained. This is an interesting exercise to think about what their nature is, but at the end of the day, embrace them for what they are. Michael On Wed, Jul 25, 2012 at 4:40 AM, Ulrich Eckhardt <ulrich.eckha...@dominolaser.com> wrote: > Hi! > > I just had an idea, it occurred to me that the pass statement is pretty > similar to the print statement, and similarly to the print() function, there > could be a pass() function that does and returns nothing. > > Example: > def pass(): > return > > try: > do_something() > except: > pass() > > > One thing I don't like about this is the syntax > > class foo(object): > pass() > > > What do you think? > > Uli > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list