2 Malcolm: > It makes a lot of sense when you think about what they can apply to. > Equality is a natural operation for all sorts of object types. The "less > than" comparison only applies to things that have a natural ordering. > The first set is much larger than the second. > A normal use for "ifequal" is testing string values for equality. not so > much for doing mathematical comparisons.
I'm disagree. ifequal at the end goes to python level of equality. So 1. a = 1, b = 1.0 2. a = 1, b = "1" ifequal 1 1.0 # True ifequal 1 "1" # False So looks like dynamic typecasting works. For example: class ClassA(object): pass class ClassB(object): pass objectA = ClassA() objectB = ClassB() if objectA < objectB: print "A < B" else: print "A > B" You still can compare them and python is not going to complain and more you can compare even objectA < 1... If you dig deeper into realization level, into django/template/ defaulttags.py: class IfEqualNode(Node): ... def render(self, context): ... if (self.negate and val1 != val2) or (not self.negate and val1 == val2): return self.nodelist_true.render(context) ... So comparison is nothing but python == and !=. I still can't get why not to implement ifless. It's like 3 min of coding. Zinovii --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---