[Lldb-commits] [PATCH] D15511: Make few adjustments after r255542.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 14 19:30:07 PST 2015


I tried to google the semantics of the in keyword, but Python documentation
is so horrible.  I literally couldn't find a description of how it works
:-/  Anyway, thanks!

On Mon, Dec 14, 2015 at 7:27 PM Todd Fiala <todd.fiala at gmail.com> wrote:

> This seems right:
>
> python
> Python 2.7.10 (default, Oct 23 2015, 18:05:06)
> [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> s = 'abc'
> >>> 'bc' in 'abc'
> True
> >>> 'bc' in s
> True
> >>> 'clang' in 'clang'
> True
>
> On Mon, Dec 14, 2015 at 6:45 PM, Siva Chandra <sivachandra at google.com>
> wrote:
>
>> On Mon, Dec 14, 2015 at 6:42 PM, Zachary Turner <zturner at google.com>
>> wrote:
>> > zturner added inline comments.
>> >
>> > ================
>> > Comment at: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py:622
>> > @@ -621,3 +621,3 @@
>> >          return list_or_lambda(value)
>> > -    elif isinstance(list_or_lambda, list):
>> > -        return list_or_lambda is None or value is None or value in
>> list_or_lambda
>> > +    elif isinstance(list_or_lambda, list) or
>> isinstance(list_or_lambda, str):
>> > +        return value is None or value in list_or_lambda
>> > ----------------
>> > I mentioned this in the other thread, but I'm not sure we want the
>> string check.  if `list_or_lambda` is a string, then I think it should just
>> check `list_or_lambda == value`.  Otherwise the test only passes when
>> `value` is a character, which is not now we use any of the decorators.
>>
>> AFAIK, there is no character type in Python. The code 'value in
>> list_or_lambda' returns True if |value| is a substring of
>> |list_or_lambda|. For example, 'db' in 'lldb' evaluates to True.
>>
>
>
>
> --
> -Todd
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151215/b02de375/attachment-0001.html>


More information about the lldb-commits mailing list