[Tutor] Efficiency of Doxygen on Python vs C++?

Eric Brunson brunson at brunson.com
Fri Aug 17 11:53:19 CEST 2007


Stephen McInerney wrote:
> Hi Alan,
>
>   
>>> My friend clarifies: "It's not the efficiency of doxygen that's the
>>> question. The problem is that you can add fields to objects as you go in
>>> Python so you need to do a deep analysis of the code to determine the 
>>>       
>> class
>>     
>>> structure which you don't have to do with C++ (or Java)."
>>>       
>> That's true it's one of the "benefits" of a dynamic language, but it does
>> make the code harder to parse.
>>     
>
> Is this not just evidence of a very bad Python coding style?
> Should we not always declare *all* class fields in the class definition
> by assigning to them, even if the assignment is token or dummy
> i.e. 'None', "", [], {} etc.
>
>   

Absolutely not.  I have several classes that build themselves 
dynamically at runtime.  As an example, one of them reads the data 
dictionary of a database.  You may as well suggest that you define all 
your dictionary keys at the beginning of the program.

>>> He mentioned numbers like maybe ~20+x slower on lines-of-code
>>> for Python vs C++.
>>>       
>> That sounds high, I would have expected no more than 5-10 times longer.
>> But of course against that we have the advantage that there will be far 
>> fewer
>> lines to parse in a Python project,  typically only a third or a quarter of
>> the number of lines - sometimes less than that.
>>     
>
> Can you cite us a literature source for saying that Python is 3-4x more
> expressive  per line-of-code than C++?
> Would come in handy for evangelizing.
>
>   
>>> A second friend of mine who is an XML/Java enthusiast echoed similar
>>> comments about scalability in large builds with weakly-typed dynamic
>>> languages such as Python.
>>>       
>> The concept of a "large build" doesn't really exist in an interpreted
>> language like Python. OTOH I probably wouldn't usePython for a
>> very large project - say over a million lines of code in C++ - for a
>> variety of other reasons. eg. Python could do it but the coordination of
>> multi team projects becomes harder without tools like static type
>> checking.
>>     
>
> Has anyone ever tried pragmas for hinting about member types as I suggested?
>
> Stephen
>
> _________________________________________________________________
> A new home for Mom, no cleanup required. All starts here. 
> http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>   



More information about the Tutor mailing list