Hi,

   The sample script below throws the exception "AttributeError: input" rather 
than the expected exception "AttributeError: non_existent_attribute".  

   Please help me write a decorator or descriptor of my own that fixes the 
issue.

class Sample(object):
    def __init__(self):
        self.arguments = {}

    def __getattr__(self, name):
        ret_val = self.arguments.get(name, None)
        if ret_val != None: return ret_val
        raise AttributeError, name
    
    @property
    def input(self):
        self.non_existent_attribute
    

sample = Sample()
sample.input


Regards,
Jacob Abraham



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to