On Sun, Jan 3, 2010 at 7:50 PM, Joseph Kocherhans <[email protected]> wrote:
> On Sun, Jan 3, 2010 at 7:34 PM, Alex Gaynor <[email protected]> wrote:
>>
>> What if we had some sort of wrapper class for objs, it could overide
>> __getattribute__ to return either an attr if it's an obj, or a
>> subscript if it's a datadict.  it seems to me this would solve both
>> concerns?
>
> I was thinking along similar lines, but with __getitem__ instead,
> basically just using a dict interface wrapping a model object, but
> that hides the model's methods. Honza makes a good point that those
> would be good to have access to. I feel a lot more comfortable
> treating a model like a dict than vice-versa, although that's
> admittedly rather arbitrary.
>
> Joseph
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To post to this group, send email to [email protected].
> 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.
>
>
>

I'm ambivalent as to which would be prefered, my one concern is people
who probably tend to forget that they could do obj["my_method"](),
since the syntax appears wonky (unless the methods were proxied by
__getattribute__).

Alex

-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

--

You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
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