[Python-Dev] Capabilities

Paul Prescod paul@prescod.net
Sun, 30 Mar 2003 14:45:38 -0800


Ka-Ping Yee wrote:
>...
> In many classes, __init__ exercises authority.  An obvious C type with
> the same problem is the "file" type (being able to ask a file object
> for its type gets you the ability to open any file on the filesystem).
> But many Python classes are in the same position -- they acquire
> authority upon initialization.

Just out of curiosity wouldn't you say that part of the capability zen 
is that capabilities that allow you to turn global strings into objects 
should either not exist or be very segmented from other capabilities? 
(in fact I remember discussing this with you at some Python conference!)

In capdesk, I believe you drag a capability for a file from one window 
to another so that the "drop target" never needs to know or care what 
the filename was.

So it might be better to separate the authority from the __init__ than 
to separate constructors from classes. Arguably it is better to add to 
the library than to change the language.

return securefile("foo.txt").reader()

x = zipfile.Zipfile(securefile("foo.txt").reader())

  Paul Prescod