[Python-checkins] CVS: python/nondist/peps pep-0221.txt,1.2,1.3
Barry Warsaw
python-dev@python.org
Tue, 22 Aug 2000 22:57:50 -0700
Update of /cvsroot/python/python/nondist/peps
In directory slayer.i.sourceforge.net:/tmp/cvs-serv3351
Modified Files:
pep-0221.txt
Log Message:
Minor editorial changes.
Index: pep-0221.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0221.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** pep-0221.txt 2000/08/20 10:49:45 1.2
--- pep-0221.txt 2000/08/23 05:57:47 1.3
***************
*** 2,18 ****
Title: Import As
Version: $Revision$
! Owner: thomas@xs4all.net (Thomas Wouters)
! Python-Version: 2.0
Status: Accepted
- Created: 15-Aug-2000
Type: Standard
Introduction
! This PEP describes the `import as' proposal for Python 2.0. This
! PEP tracks the status and ownership of this feature. It contains a
! description of the feature and outlines changes necessary to
! support the feature. The CVS revision history of this file
contains the definitive historical record.
--- 2,19 ----
Title: Import As
Version: $Revision$
! Author: thomas@xs4all.net (Thomas Wouters)
Status: Accepted
Type: Standard
+ Python-Version: 2.0
+ Created: 15-Aug-2000
+ Post-History:
Introduction
! This PEP describes the `import as' proposal for Python 2.0. This
! PEP tracks the status and ownership of this feature. It contains
! a description of the feature and outlines changes necessary to
! support the feature. The CVS revision history of this file
contains the definitive historical record.
***************
*** 20,30 ****
Rationale
! This PEP proposes a small extention of current Python syntax
! regarding the `import' and `from <module> import' statements.
! These statements load in a module, and either bind that module to
! a local name, or binds objects from that module to a local name.
! However, it is sometimes desirable to bind those objects to a
! different name, for instance to avoid name clashes. Currently, a
! round-about way has to be used to achieve this:
import os
--- 21,31 ----
Rationale
! This PEP proposes an extention of Python syntax regarding the
! `import' and `from <module> import' statements. These statements
! load in a module, and either bind that module to a local name, or
! binds objects from that module to a local name. However, it is
! sometimes desirable to bind those objects to a different name, for
! instance to avoid name clashes. This can currently be achieved
! using the following idiom:
import os
***************
*** 32,36 ****
del os
! And similar for the `from ... import' statement:
from os import fdopen, exit, stat
--- 33,37 ----
del os
! And similarly for the `from ... import' statement:
from os import fdopen, exit, stat
***************
*** 46,50 ****
The `as' name is not intended to be a keyword, and some trickery
! has to be used to convince the CPython parser it isn't one. For
more advanced parsers/tokenizers, however, this should not be a
problem.
--- 47,51 ----
The `as' name is not intended to be a keyword, and some trickery
! has to be used to convince the CPython parser it isn't one. For
more advanced parsers/tokenizers, however, this should not be a
problem.
***************
*** 55,63 ****
import os.path
! The actual name stored locally is `os', not `path' (so that the
! newly imported module can be referenced as `os.path'.) When
! introducing the `as' keyword, it is unclear whether the `os'
! module or the `path' sub-module should be stored `as' the
! requested local name.
--- 56,63 ----
import os.path
! The actual name stored locally is `os', not `path', and the newly
! imported module can be referenced as `os.path'. When introducing
! the `as' keyword, it is unclear whether the `os' module or the
! `path' sub-module should be stored `as' the requested local name.
***************
*** 65,71 ****
This PEP has been accepted, and the suggested code change has been
! checked in. The patch can still be found in the SourceForge patch
! manager[1]. Currently, a NAME field is used in the grammar rather
! than a bare string, to avoid the keyword issue. It introduces a
new bytecode, IMPORT_STAR, which performs the `from module import
*' behaviour, and changes the behaviour of the IMPORT_FROM
--- 65,71 ----
This PEP has been accepted, and the suggested code change has been
! checked in. The patch can still be found in the SourceForge patch
! manager[1]. Currently, a NAME field is used in the grammar rather
! than a bare string, to avoid the keyword issue. It introduces a
new bytecode, IMPORT_STAR, which performs the `from module import
*' behaviour, and changes the behaviour of the IMPORT_FROM
***************
*** 80,86 ****
An additional change to this syntax has also been suggested, to
! generalize the expression given after the `as' clause. Rather than
! a single name, it could be allowed to be any expression that
! yields a valid l-value; anything that can be assigned to. The
change to accomodate this is minimal, as the patch proves[2], and
the resulting generalization allows a number of new constructs
--- 80,86 ----
An additional change to this syntax has also been suggested, to
! generalize the expression given after the `as' clause. Rather
! than a single name, it could be allowed to be any expression that
! yields a valid l-value; anything that can be assigned to. The
change to accomodate this is minimal, as the patch proves[2], and
the resulting generalization allows a number of new constructs
***************
*** 104,112 ****
References
! [1]
! http://sourceforge.net/patch/?func=detailpatch&patch_id=101135&group_id=5470
! [2]
! http://sourceforge.net/patch/?func=detailpatch&patch_id=101234&group_id=5470
--- 104,110 ----
References
! [1] http://sourceforge.net/patch/?func=detailpatch&patch_id=101135&group_id=5470
! [2] http://sourceforge.net/patch/?func=detailpatch&patch_id=101234&group_id=5470