[Python-Dev] a quit that actually quits (original) (raw)
François Pinard pinard at iro.umontreal.ca
Wed Dec 28 19:42:16 CET 2005
- Previous message: [Python-Dev] a quit that actually quits
- Next message: [Python-Dev] a quit that actually quits
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Alex Martelli]
On Dec 28, 2005, at 3:24 AM, Michael Hudson wrote:
skip at pobox.com writes:
Fredrik> a quit/exit command that actually quits, instead of Fredric> printing a "you didn't say please!" message.
I like Fredrik's idea more and more.
The thing that bothers me about it is that the standard way you tell python to do something is "call a function" -- to me, a special case for exiting the interpreter seems out of proportion.
Just brainstorming, but -- maybe this means we should generalize the idea? I.e., allow other cases in which "just mentioning X" means "call function Y [with the following arguments]", at least at the interactive prompt if not more generally.
Just brainstorming then! :-)
The fact that dot notation is used both for accessing globals from a module, and attributes from a class or an instance, does not mean that modules are classes, but surely, they are instances of something, and maybe we could build more on the similarities despite the differences.
Through getattr (and also properties and more generally
descriptors), it is possible to create instance attributes triggering
functional behaviour. Maybe it could be useful creating some (vaguely)
similar mechanism for modules' globals. Then, quit' and
exit' could
be mere cases of that mechanism.
It is desirable, in my opinion, that interactive behaviour be as identical as possible as script behaviour: the automatic printing of interactive mode is already much magic that newcomers need to sort out.
-- François Pinard http://pinard.progiciels-bpi.ca
- Previous message: [Python-Dev] a quit that actually quits
- Next message: [Python-Dev] a quit that actually quits
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]