Forgetting "()" when calling methods

Brian Quinlan brian at sweetapp.com
Sat Apr 26 04:39:30 CEST 2003


Erik Max Francis wrote:
> One thing that PyChecker, at least, is more likely to catch is "code
has
> no effect" statements like
> 
> 	sys.exit

How do you know that the code has no effect?

> Without the parentheses, this clearly can't do anything useful, 

class Sys:
    def __getattr__(self, attr):
        if attr == 'exit'
            print 'cya'

sys = Sys()






More information about the Python-list mailing list