[PEAK] Permissions for class with __getitem__
rk at dat.cz
Mon Feb 14 09:24:35 EST 2005
On Mon, Feb 14, 2005 at 08:39:35AM -0500, Phillip J. Eby wrote:
> At 01:46 PM 2/14/05 +0100, Radek Kanovsky wrote:
> >I know it is minor problem but anyway 'x in y' expression is slightly
> >ambiguous. Wouldn't be better to deprecate form 1 when we can now use
> >unambiguous and more clear ``isinstance(subj, classobj)'' expression?
> It doesn't seem to me that it would fix your problem, since it's form 2
> that's causing a problem in your case.
I thought about removing form 1 implementation from signature parser
and replacing existing '... in ...' expressions with more explicit
isinstance(...) or adapt(...) expressions:
"isinstance(self,Context) and isinstance(subject,classobj) and name==attrname"
This solves my problem.
> I need to keep option 1 open though, because in future there will be other
> things you can use on the right side of 'in'/'not in', in order to do
> pattern matching.
There is some ambiguity or magic here from my point of view but my
opinion may change :-) Generic functions are novelty for me.
> So, maybe the fix would be to give form 1 priority over form 2, instead of
> the other way around. I don't remember why I made the priorities that way
> anyway, except that it seemed like it would be more backward-compatible
> with normal "in" expressions that way.
Or remove form 2 and reserve 'in' for GF??? I haven't seen any usage of it yet.
More information about the PEAK