>> Here's the other problem I'd like to catch:
>>     class X(object):
>>         ...
>>         def get_foo(self):
>>             return self._foo
>>         foo = property(get_foo)
>> The problem here is that I have violated this Zen of Python dictum:
>>     There should be one-- and preferably only one --obvious way to do it.
>>
>> I will admit that I sometimes go back and forth on property objects.
>
>
> But there is no obvious one way to do this in Python.

Correct, but I would just like to be alerted that perhaps I should
consider narrowing my API.  Some of the code base I work on was around
before Python 2.2 was available.  Over time, people have started to
add property-based setters and getters.  In many circumstances, we
should probably pick one way to do it, in this case self.foo vs
self.get_foo().  I'm just looking for the message to remind me to
consider the API duplication.  I'm not suggesting pylint or other
tools should recommend one or the other.

Skip
_______________________________________________
code-quality mailing list
code-quality@python.org
http://mail.python.org/mailman/listinfo/code-quality

Reply via email to