25 Nov
2013
25 Nov
'13
2:55 p.m.
On 11/24/2013 10:21 PM, Chris Angelico wrote:
But then you have to explain why you're using 'is' to compare strings, which shouldn't normally be done. Why not just use == as per current?
In the case of generally parsing strings, that is correct as there may be more than one of something that can match. But when there is only *one* of something, and you aren't manipulating the parts, then "is" should be ok. __name__ would be bound directly to __main__'s string object, so "is" or "==" should always work for that case. Cheers, Ron