Ed Leafe wrote:
> On Jun 11, 2008, at 5:13 PM, Paul McNett wrote:
> 
>> When reading the code, the __init__ isn't cluttered with irrelevant
>> information.
> 
> 
>       One, irrelevant is in the eye of the beholder. I like to add comments  
> to the declarations, so that others reading the code have an idea what  
> these atts are for.
> 
>       If it was a matter of tidiness, you could always do something like:
> 
> def __init__(self, ...):
>       self._declarePropertyAttributes()
>       ...
> 
> def _declarePropertyAttributes(self):
>       self._foo = 1
>       self._bar = None
>       etc.

Okay, it is a matter of tidiness, and part of being tidy keeps the 
initialization of a property attribute with the property, not with the 
containing class.

I think it just comes down to having 2 places to refer to the attribute, 
instead of one. What I meant by "encapsulation" in a prior message.

Another slight pro to my way is that if you never refer to a given 
property, the attribute never gets defined, as opposed to perhaps 
defining unneeded attributes when the class is instantiated.

And what is gained by defining the property attributes 'up above'? I 
have to reject the ability to comment on their use, as that would be 
self-explanatory from within the property definition.

But this isn't really worth arguing about, either.

Paul


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to