On 7/12/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote:
> As I was writing this, I realized that you can't do this in Python
> because you can't overload function names, but surely somebody smarter
> than me can figure out a clever way that model_instance.form() and
> ModelClass.form() would both do the right thing.

I won't comment on whether this is a good idea, because I doubt I'd
ever use it either way, but what you're asking for can be done using a
descriptor.[1] Just check whether the "instance" argument is None to
know if it was called from the class.

-Gul

[1] http://docs.python.org/ref/descriptors.html

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to