I noticed that I forgot one of the more important ones.  Programs that rely on 
hashing to determine equivalence can be screwed up by whitespace.  This is 
probably the main reason that git doesn't like it.  If you add whitespace to 
the end of a line, the hash of that commit will be different from if you 
hadn't.  And the worst part is that in a non-colored diff, it will just look 
like:

--- if x:
+++ if x: 

Or if you try to hash-check two files for differences, you will get false 
negatives based solely on trailing whitespace. Since trailing whitespace is 
invisible without a special editor, this is not a good thing.

Aaron Meurer
On Jul 5, 2010, at 11:40 AM, Harold E. wrote:

> Thanks for the explanations! I will never see trailing spaces in the
> same way now. I use Eclipe and it has an option to delete
> automatically trailing spaces, but I disabled it since I found it
> anoying.
> 
> Harold
> 
> On 10 juin, 20:40, "Aaron S. Meurer" <[email protected]> wrote:
>> There are a few reasons that trailing whitespace is bad.  For one thing, git 
>> will bug you endlessly about it if it is there, and it adds ugly red blocks 
>> where it is in a git diff (this is how I noticed it).  I guess the problem 
>> is that you can't tell it is there, unless you have an editor that 
>> explicitly shows it to you. There are probably all kinds of other problems 
>> that it can cause.  For example, suppose you wanted to find all lines of 
>> Python code that use one-liner syntax for if or while loops, such as
>> 
>> if x: return True
>> 
>> You could try grepping for :.+$, but if you have regular if x: lines with 
>> trailing whitespace after the :, it will grab those too.  This is just a 
>> simple example, but you can see how it can throw things off.  Also, it is 
>> particularly important for languages like Python where whitespace is part of 
>> the syntax.  Maybe others will also have some good reasons.  
>> 
>> And frankly, it makes for cleaner code.
>> 
>> By the way, depending on what editor you use, there is probably a way to set 
>> it to automatically clear trailing whitespace on a save. Then you just don't 
>> have to worry about it.
>> 
>> Aaron Meurer
>> 
>> On Jun 10, 2010, at 11:23 AM, Harold E. wrote:
>> 
>>> Ok for the trailing spaces, I did not know. For curiosity, why are
>>> they deprecated?
>>> The next times I will think to test and things like that.
>> 
>>> Harold
>> 
>>> On 10 juin, 20:11, "Aaron S. Meurer" <[email protected]> wrote:
>>>> Great!  One thing that I can see right away in GitX is that you need to 
>>>> clear trailing whitespace in your files.   The bin/strip_whitespace 
>>>> utility will help you with this, and the 
>>>> sympy/utilities/tests/test_code_quality.py test will tell you if you have 
>>>> any.  It's a good idea to run ./bin/test before committing anyway.
>> 
>>>> Looking forward to your work.
>> 
>>>> Aaron Meurer
>>>> On Jun 10, 2010, at 10:59 AM, Harold E. wrote:
>> 
>>>>> Thanks to Vinzent I created a repo on Github with a branch for units :
>>>>> http://github.com/melsophos/sympy/tree/units
>>>>> I will work on it essentially during the summer since I'm in stage
>>>>> now.
>> 
>>>>> Harold
>> 
>>>>> On 16 mai, 19:43, Vinzent Steinberg <[email protected]>
>>>>> wrote:
>>>>>> On 16 Mai, 00:11, "Harold E." <[email protected]> wrote:
>> 
>>>>>>> On 15 mai, 23:40, "Aaron S. Meurer" <[email protected]> wrote:
>> 
>>>>>>>> Go ahead and create an issue for it.  If you can push the changes up 
>>>>>>>> to github, that would also make things easier.
>> 
>>>>>>> There is no need to have a certain status to push? Also is it not
>>>>>>> preferable to wait that my code is almost done?
>> 
>>>>>> It does not hurt to publish your work in progress on github, so we can
>>>>>> already have a look at it before. Of course it will be pushed to
>>>>>> master only if done.
>> 
>>>>>> Release early, release often. :)
>> 
>>>>>> Vinzent
>> 
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "sympy" group.
>>>>>> To post to this group, send email to [email protected].
>>>>>> To unsubscribe from this group, send email to 
>>>>>> [email protected].
>>>>>> For more options, visit this group 
>>>>>> athttp://groups.google.com/group/sympy?hl=en.
>> 
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups 
>>>>> "sympy" group.
>>>>> To post to this group, send email to [email protected].
>>>>> To unsubscribe from this group, send email to 
>>>>> [email protected].
>>>>> For more options, visit this group 
>>>>> athttp://groups.google.com/group/sympy?hl=en.
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "sympy" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected].
>>> For more options, visit this group 
>>> athttp://groups.google.com/group/sympy?hl=en.
>> 
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/sympy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to