[Python-Dev] Patch to use dict subclasses in eval(), exec
David Ascher
DavidA@ActiveState.com
Tue, 29 Oct 2002 11:05:06 -0800
Guido van Rossum wrote:
> 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.
>>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. =)
--da