Assigning empty value or string in Python

python

Solution

Checking equality with `==`

>>> string = ""
>>> s = "abcd:"
>>> str1, str2 = s.split(':')
>>> str1
'abcd'
>>> str2
''
>>> str2 == string
True

Maybe you were trying to compare with `is`. This is for testing identity: `a is b` is equivalent to `id(a) == id(b)`.

Or check both strings for emptiness:

>>> not str2
True
>>> not string
True
>>> 

So that both are empty ...

Problem

I would like to understand if there is a difference between assigning an empty value and an empty output, as follows: 1> Assigning a value like this ``` string = "" ``` 2> An empty value returned as output ``` string = "abcd:" str1, str2 = split(':') ``` In other words, is there a difference in values of 'string' in 1> and 'str2' in 2>? And how would a method see the value of 'str2' if it is passed as an argument?

Original source