Pavol Juhas <[email protected]> wrote:

> On Friday, December 16, 2016 at 1:58:59 PM UTC-5, Dominique Pelle wrote:
> ...
>> While testing, I found what looks like a possible small bug:
>>
>> :echo str2float(" + 1.2")
>> 1.2
>>
>> :echo str2float(" - 1.2")
>> 0.0
>>
>> I would expect 2nd command to print -1.2, or is
>> there a reason for non-symmetrical behavior?
>
> Python 3.5 raises ValueError for both of those strings.  I think
> that is a reasonable behavior, because signs are thus required to be
> a part of the number word.  "+ 1.2" could be considered as much
> invalid as is "1 . 2".

I also think that it's odd to accept spaces between the
sign and the digits.  However, Vim already accepts spaces
after the - sign and not after the + sign  (inconsistency addressed
in patch in this thread).   If we instead give an error for
str2float(" + 1.2"), then we break compatibility and potentially
break existing scripts.

Dominique

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui