New PEP: The directive statement

Carlos Ribeiro carribeiro at yahoo.com
Fri Mar 23 17:27:34 EST 2001


I have some questions that I collected around several posts that aren't 
fully explored. First the questions, the some comments of mine:

1) Topic: People seems to be divided over the value of "introspection".

1.1) Is introspection a desirable feature of any "directive-like" solution?
1.2) Do we have time to implement introspection in the "directive" patch?
1.3) If so, isn't sufficient to implement a global dictionary called 
__directive__ to store it?

2) Topic: Right now, directives operate on a per-module basis.

2.1) What's going to happen in a multi module project with different 
directive settings for each module?
2.2) What happens if one function inside a module calls a function on a 
module where the directive setting is different?

3) Topic: In the future directive may become a keyword, and it will be 
possible to place directives anywhere inside the source code.

3.1) Will we be able to set/reset/test/save directives (features?)?
3.2) What about directive scoping? Some directives may be valid at module 
scope, other for a class, others for a function, others anywhere.
3.3) If we have different scopes for some directives, how are we going to 
handle introspection? A global dictionary is not enough anymore.

4) Topic: Directives have both runtime and compile-time behavior.

4.1) Do we need directives for things that may be implemented using *only* 
runtime behavior?

5) Topic: CPython x The world

5.1) Is it possible to patch directives into all Python implementations?
5.2) Are we going to see directives that apply only to some selected 
platforms or implementations?


My comments:

a) Directives should only be used to control compile time behavior. This 
solve a lot of the open issues. One's code runtime behavior should not 
*ever* depend upon directive settings. Otherwise, we're going to have 
*lots* of scope related problems. The only allowable exception would be the 
use for documentation purposes. Anything else may be implemented using 
"flags", be it through parameters, global variables, etc.

b) Directives *may* be useful in different scopes - module, class or 
function. Restriction (a) helps to minimize any scoping problems.

c) Please keep the proposal *simple*.


Man, this is turning into a nightmare...


Carlos Ribeiro
cribeiro at mail.inet.com.br
carribeiro at yahoo.com


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





More information about the Python-list mailing list