[Python-Dev] Patch to use dict subclasses in eval(), exec

Guido van Rossum guido@python.org
Tue, 29 Oct 2002 14:11:13 -0500


>  > I think (2) could be resolved using "ghosts" -- this is what Zope's
>  > persistency mechanism uses.  The names must be present, but their
>  > content is loaded on demand.  I expect that (1) probably could also be
>  > solved this way.
> 
> That assumes that you can "preload" all of the names at
> initialization, correct?  IOW, that you know the contents of the
> namespace in advance.  Not a huge limitation, but not the same as
> lazy ghost-creation on lookup.

Correct.  I don't see this as a huge limitation -- all "autoload"
features that I'm familiar with (Emacs, Tcl; how about Perl?) require
you to know at least the auto-loaded names in advance.  (Also in my
defence you only mentioned the cost of unpickling everything as an
argument. :-)

> >>PS: Thinking of PHP, the fact that I can look up variables defined
> >>in sessions or cookies or whatnot really really easily is one of the
> >>reasons I'm liking PHP more than Python for web programming these
> >>days.  I don't know enough of the technical details of the web to
> >>know automatically where what data is stored and in what format --
> >>and PHP doesn't make me.  Maybe web folks would use the
> >>dict-subclass feature to emulate this aspect of PHP.
> > 
> > 
> > But why not make it an attribute lookup?  That's how Zope (again :-)
> > deals with this.  Remember acquisition? :-)
> 
> Yah, I remember.  I'm not saying that one can't come up with a
> pythonic yet low-impact way of presenting web constructs to users.
> I guess I'm just expressing frustration with the fact that in PHP I
> don't really need to understand the web, whereas in Python I feel I
> have to.  Seems wrong. =)

I guess this depends on which Python application you use.

--Guido van Rossum (home page: http://www.python.org/~guido/)