The `is` operator in Python checks for identical objects. A string is not guaranteed to be exactly the same object as another string (in this example "True" is not the same object (bytes in memory) as the second "True", so Python rightly sees that they are not the same object.
True, False, and None are singletons, that are guaranteed to always point to the exact same object in memory, and `is` is the appropriate operator to use there. It is for those singletons that this feature is being added. > On Apr 7, 2016, at 4:42 PM, Stephen Kelly <steve...@gmail.com> wrote: > > Hello, > > I reviewed > > https://github.com/django/django/commit/c00ae7f5 > > while updating the features of Grantlee, and I have the following notes: > > * The unit tests added both have the same name ("template"). They should > have different names of the form 'if-tag-isNN' > * The feature does not work the same way as django 'is' works. For example: > > In: t = e.from_string( > "{% if \"True\" is \"True\" %}yes{% else %}no{% endif %}") > In: t.render(c) > > Out: 'no' > > The feature 'if ... is' feature looks like it needs more design > consideration before it is released. > > Thanks, > > Steve. > > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > Visit this group at https://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/ne6k90%249b3%241%40ger.gmane.org. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/4FEBF18F-960B-4650-AE49-0E03D7E84AF3%40ryanhiebert.com. For more options, visit https://groups.google.com/d/optout.