[Patches] [ python-Patches-404997 ] Alternative to __future__ imports

noreply@sourceforge.net noreply@sourceforge.net
Mon, 19 Mar 2001 21:22:41 -0800


Patches item #404997, was updated on 2001-02-28 13:57
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=404997&group_id=5470

Category: Parser/Compiler
Group: None
Status: Open
Priority: 5
Submitted By: Martin v. Löwis (loewis)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: Alternative to __future__ imports

Initial Comment:
This patch adds an alternative notation for selecting
nested scopes on the module level, by means of a 

directive nested_scopes

declaration. This is a declaration, and it may only
appear at the "beginning" of a module. Even though it
adds a keyword "directive", this is only a keyword if
it appears as the first keyword in the file; as a
result, 

def directive():
  directive = 1

is still accepted (even without warning, but that could
be changed if desired).

The patch currently only accepts the directives that
are also __future__ imports, although it can be
extended to allow other things, e.g.

directive source_encoding "latin-1"

This is possible since the syntax allows an optional
atom after the directive's name.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-03-19 21:22

Message:
Logged In: YES 
user_id=31435

SourceForge is driving me nuts today.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-03-19 21:21

Message:
Logged In: YES 
user_id=31435

Assigned to Guido:  since the patch would replace the 
current future_statement implementation, doing anything 
with it before Friday would require BDFL decree.

I personally like that future_statements don't look like 
general directives:

directive integer_division
directive left_hand_side_swap

Over time, the set of names grows, and it won't be clear 
which directives are dead-serious business (like an 
incompatible language change) and which minor tweaking of 
pragmatics.

An extension was briefly discussed on c.l.py, along the 
lines of adding another word, e.g.

directive future integer_division
directive pragma left_hand_side_swap

Whatever, AFAIK that didn't get implemented, and there's no 
PEP for it (or this) in any case (BTW, while I would like 
to see a PEP for a general directive facility, I'm not 
going to write one).

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-03-19 20:58

Message:
Logged In: YES 
user_id=31435

@Home is major-league hosed; switching to another ISP to 
delete 3 of the 4(!) patch copies I managed to attach to 
this.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-03-19 20:11

Message:
Logged In: YES 
user_id=31435

Trying to attach the patch (for whatever reason, it took 
about 15 minutes to retrive it from the URL given).

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-03-19 20:10

Message:
Logged In: YES 
user_id=31435

Trying to attach the patch (for whatever reason, it took 
about 15 minutes to retrive it from the URL given).

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-03-19 20:08

Message:
Logged In: YES 
user_id=31435

Trying to attach the patch (for whatever reason, it took 
about 15 minutes to retrive it from the URL given).

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-03-19 20:04

Message:
Logged In: YES 
user_id=31435

Trying to attach the patch (for whatever reason, it took 
about 15 minutes to retrive it from the URL given).

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-02-28 22:09

Message:
Logged In: YES 
user_id=21627

Sigh. The patch is now at
http://www.informatik.hu-berlin.de/~loewis/python/directive.diff

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-02-28 22:06

Message:
Logged In: YES 
user_id=21627

Retry uploading the patch

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=404997&group_id=5470