On Fri, Apr 11, 2008 at 12:02 PM, Patryk Zawadzki <[EMAIL PROTECTED]> wrote: > Why not use the opposite test and check for instances of dict?
Because then you have to pass something that subclasses dict instead of something that implements the interface of dict. We could go on and on about this all day. The usual way to approach something like this would be to check for some attribute of contexts that aren't part of the standard dictionary protocol. Since contexts work mostly like dicts, the only real differences are the push() and pop() methods, which dicts don't support. Welcome to duck typing. def render(self, context): "Display stage -- can be called many times" if not hasattr(context, 'push'): context = Context(context) return self.nodelist.render(context) Of course, I should note that I actually don't have an opinion on this subject. I'm merely offering an option to suit both sides of the equation. -Gul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers?hl=en -~----------~----~----~----~------~----~------~--~---