[Scons-users] Module Scons.Util

Bill Deegan bill at baddogconsulting.com
Sun Oct 1 16:37:06 EDT 2017


James,

You responded to the digest message rather than this thread:

No you did not quite get that Bill
> The elif clearly limits the type of s at this point to a duck type of
> sequence
> then l is initialized to an empty sequence type
> then in the for loop for each element of s the function recursively is
> called on the element returning a string which is appended to l
> l is then discarded on the return of the join of s with a blank between
> each. This assumes all the elements of s can be converted to a string type
> for the join.
> Thus l is unneeded and so is the for loop over s, which merely appends
> everything to l.
>

Gotcha. I see that now.
Strange, let me look at the history and see if is a bad merge, regardless
needs to be cleaned up.

-Bill

On Sun, Oct 1, 2017 at 10:27 AM, Bill Deegan <bill at baddogconsulting.com>
wrote:

> I think you're mistaken.
> If s is a UserString or not a Sequence or BaseStringTypes then it's
> actually doing something.
>
> It could probably be rewritten as:
>
> return ''.join([to_String_for_subst(e) for e in s])
>
>
>
> On Sun, Oct 1, 2017 at 10:16 AM, James Rinkevich <rinkevichjm at gmail.com>
> wrote:
>
>> in this function
>> def to_String_for_subst(s,
>>                         isinstance=isinstance, str=str,
>> to_String=to_String,
>>                         BaseStringTypes=BaseStringTypes,
>> SequenceTypes=SequenceTypes,
>>                         UserString=UserString):
>>
>>     # Note that the test cases are sorted by order of probability.
>>     if isinstance(s, BaseStringTypes):
>>         return s
>>     elif isinstance(s, SequenceTypes):
>>         l = []
>>         for e in s:
>>             l.append(to_String_for_subst(e))
>>         return ' '.join( s )
>>     elif isinstance(s, UserString):
>>         # s.data can only be either a unicode or a regular
>>         # string. Please see the UserString initializer.
>>         return s.data
>>     else:
>>         return str(s)
>>
>> the lines
>>         l = []
>>         for e in s:
>>             l.append(to_String_for_subst(e))
>> have no effect and just waste time, perhaps someone intended the return
>> line to be
>>        return ' '.join( l )
>> instead of
>>        return ' '.join( s )
>>
>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20171001/b1046bcf/attachment-0001.html>


More information about the Scons-users mailing list