<div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">>How about "broke" instead of "deprecated":<br>><br>><br>> >>> class Old:
<br>>... def __init__(self):<br>>... self._value = 'broke'<br>>... value = property(lambda self: self._value)<br>>...<br><br>How is this broken? Properties are not supported for old-style classes.
<br>They may not support features introduced in new-style classes, but that's<br>hardly the same as "broken".<br></blockquote></div><br>What does that give you that this does not:<br><br>class Old:<br> def __init__(self):
<br> self.value = 'broke'<br><br>To further illustrate, what happens when you do this:<br><br>class Old:<br> def __init__(self):<br> self._value = 'broke'<br> def _set_value(self, val):<br> print "set called"
<br> def _get_value(self):<br> print "get called"<br> return self._value<br> value = property(_get_value, _set_value)<br><br>x = Old()<br>print x.value<br>x.value = "not broke"<br>print x.value<br>print type(
x.value)<br>print x._value<br><br>This is what happens:<br><br>>>> x = Old()<br>>>> print x.value<br>get called<br>broke<br>>>> x.value = "not broke"<br>>>> print x.value<br>not broke
<br>>>> print type(x.value)<br><type 'str'><br>>>> print x._value<br>broke<br><br>Now, no exceptions were raised or anything, but with old-style classes I'm having difficulty thinking of a scenario where they might actually be useful. I suppose you could use it to do a calculation on instance variables and return the result. You are probably better of using a method for that anyway though.
<br><br>Matt<br>