Changes between Initial Version and Version 1 of Ticket #15671, comment 16


Ignore:
Timestamp:
May 9, 2011, 11:39:57 PM (13 years ago)
Author:
Chris Beaven

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15671, comment 16

    initial v1  
    11Are you sure? I was under the impression that `hasattr` is what was suppressing the errors.
     2
     3EDIT: specifically, here's a quick test:
     4
     5{{{
     6Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
     7[GCC 4.5.2] on linux2
     8Type "help", "copyright", "credits" or "license" for more information.
     9>>> class C(object):
     10...     @property
     11...     def x(self):
     12...         return 1 // 0
     13...
     14>>> c = C()
     15>>> hasattr(c, 'x')
     16False
     17>>> getattr(c, 'x', None)
     18Traceback (most recent call last):
     19  File "<stdin>", line 1, in <module>
     20  File "<stdin>", line 4, in x
     21ZeroDivisionError: integer division or modulo by zero
     22}}}
Back to Top