[wingide-users] Use two # symbols when commenting out a region

Michael Foord fuzzyman at voidspace.org.uk
Thu Jun 25 12:18:01 MDT 2009


Encolpe Degoute wrote:
> Michael Foord a écrit :
>   
>> Encolpe Degoute wrote:
>>     
>>> Michael Foord a écrit :
>>>  
>>>       
>>>> Hello all,
>>>>
>>>> From the IDLE mailing list (the final text is from Guido van Rossum):
>>>>
>>>> http://mail.python.org/pipermail/idle-dev/2009-June/002766.html
>>>>
>>>>    
>>>>         
>>>>>>> Why does IDLE use two hash marks for comments (##)? Most other
>>>>>>>           
>>>>>>>               
>>>> editors
>>>>    
>>>>         
>>>>>>> (Geany, SPE) use a single hash mark (#) to designate comments.
>>>>>>>
>>>>>>>           
>>>>>>>               
>>>>>> I actually don't know. I find that it's rather useful since I usually
>>>>>> use the commenting function to comment out blocks of code, and having
>>>>>> these commented with "##" differentiates them from comments which I
>>>>>> write manually.
>>>>>>
>>>>>>         
>>>>>>             
>>>>> +1 this is exactly how I use it.
>>>>>       
>>>>>           
>>>> And this is how it's meant to be used. Quickly comment or uncomment a
>>>> section of code. Invaluable.
>>>>
>>>>     
>>>>         
>>> -1
>>> I'm using ## for a code explanation and # for a commented out code.
>>>
>>>   
>>>       
>> Well I tend to never leave commented out code in production, so use
>> single hash for comments. :-)
>>
>>     
>
> In big projects with a good longevity, some pieces of code raise errors
> when you migrate to a new version. The original developer is unreachable
> and nobody know want he was trying to do. Then you put a compatibility
> warning 'XXX' a date and comment out the code before to write a new one.
>
> I think it is a good practice until you are sure that the replacement
> code is safe.
>
>   
That's what version control is for... (I'm working on a project which 
although only 3 years old has about 200 000 lines of code - so medium 
sized I guess. We don't commit commented out code which is a practise I 
have taken into all the projects I'm involved in. In fact we do 
*minimal* commenting as they tend to get stale - by default we refer to 
all comments as 'lies'.)

Michael

-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog




More information about the wingide-users mailing list