• Kirill Smelkov's avatar
    *: Compare strings by == or != instead of by `is` or `is not` · b1c4c044
    Kirill Smelkov authored
    In python `is` checks object identity, not content:
    
        In [1]: a = 'hello'
    
        In [2]: a += ' world'
    
        In [3]: b = 'hello world'
    
        In [4]: id(a)
        Out[4]: 139735676540976
    
        In [5]: id(b)
        Out[5]: 139735675829040
    
        In [6]: a is b              <-- NOTE
        Out[6]: False
    
        In [7]: a == b              <-- NOTE
        Out[7]: True
    
    So comparing strings by is is generally incorrect.
    
    -> Fix strings comparision to use == / != everywhere (at least in found
    places where string is compared wrt string literal)
    
    We already had similar fix in a8526f4e, but seems the story continues
    again.
    
    /cc @alain.takoudjou, @Just1, @lu.xu, @jhuge, @tomo
    /reviewed-by @jerome
    /reviewed-on !122
    b1c4c044
monitor_partition_space.py 9.24 KB