> Then you'd be tripped up and ends up completly confused by any raw
> python code. Did you ever tried comparing a string and an int in
> Python ???

Doh. I knew that. For some reason the fact that it was template code
sent my brain to sleep.

> > Does anyone else think that there should be an elegant way to deal
> > with comparing different types in a template?
>
> This is already the case : the ifequal tag relies on Python's equality
> testing, which is defined by the classes of the two objects to be
> compared.
>
> http://docs.python.org/ref/customization.html
>
> > I almost wonder if we
> > need to either:
> > a) implicitly coerce types
>
> yuck.

Agreed

> > or b) throw an exception (or at least log a warning)
>
> Why so ?
>
> > The current behaviour turns Python into a loosely typed language in
> > the worst possible way.
>
> I'm not sure I get your point here... The "current behaviour" of
> ifequal is actually the the current behaviour of Python's equality
> testing.

My point was muddled (next time - think>post instead of post>think...)

However. The fact we are in Django's template language with less of
the niceties of Python does change things. We can't explicitly cast
types so what should we do?
<snip>

> Also and FWIW,  the use case (hem...) mentionned in the django-snippet
> you linked to is IMHO a design smell. Such a test has nothing to do in
> a template.

I'd be interested to read exactly what the design smell is here. Could
you elaborate?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to