[Tutor] Efficiency of Doxygen on Python vs C++?
Eric Brunson
brunson at brunson.com
Sat Aug 18 18:54:57 CEST 2007
Stephen McInerney wrote:
> Kent,
>
>
>>> I was asking if it's a recognized good programming practice to
>>> declare and initialize *all* members in the class defn.
>>>
>> What do you mean by "initialize *all* members in the class defn"?
>>
> - obviously I meant to say do it in the __init__() method,
> I wrote the snippet as I was rushing out the door to an exam,
> but I think the intent was clear.
>
>
>> If you mean to initialize the variables in the __init__() method:
>> maybe this is more common but I don't think I have ever seen it recommended
>> to initialize all variables in the __init__() method. Certainly there are
>> times when it makes sense to have some of the initialization in other
>> methods that are called from __init__().
>>
>
> I only said "make a token dummy assignment in __init__() to hint
> to the static analyzer the name and expected type, I didn't say
> "you must do all the actual initialization itself in __init__()".
>
I guess my only thought is that this "static analyzer" is simply a
holdover from your Java/C++ programming experience. It just doesn't
really make sense in a dynamic language. I'd rather spend my time
actually writing the documentation than litter my code so some other
software can do it for me.
I'm not saying it isn't a good idea in Java, I'm just not sold on the
concept in python. Just write doc strings, people have already written
utilities to parse and display them.
> In the context of the original question
> "where and how should we assign class members in order
> to flag member names and types to static analyzers like
> Doxygen or pylint?"
> I understood that people were agreeing
> "Yes, assigning each member token values in the __init__()
> method is a good practice".
>
>
>>> I think I'm hearing a general yes on that - any other opinions?
>>>
>> Not sure where you think you are hearing a yes, I am hearing a lot of
>> objections.
>>
>
> No they didn't - they said that this cannot be done for true dynamic code,
> which is true, but obviously doesn't apply to working with
> static analysis tools, which is what the question was about.
>
> Regards,
> Stephen
>
> _________________________________________________________________
> Messenger Café — open for fun 24/7. Hot games, cool activities served daily.
> Visit now. http://cafemessenger.com?ocid=TXT_TAGHM_AugHMtagline
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list