This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Multi-line imports implementation
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: anthonybaxter Nosy List: anthonybaxter, ddorfman, gvanrossum
Priority: normal Keywords: patch

Created on 2004-08-11 11:25 by ddorfman, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mlimport4.diff ddorfman, 2004-08-14 10:14 Implementtion including tests and refman update (rev 2)
Messages (6)
msg46675 - (view) Author: Dima Dorfman (ddorfman) Date: 2004-08-11 11:25
Implementation of multi-line imports. As discussed on python-dev, 
this variant accepts

  from sys import (stdin, stdout)

but not

  from sys import (*)
  import (os)

or any variants thereof. This patch is intended to be complete and 
ready for commit after someone reviews it. The following files are 
machine-generated and need to be committed along with these 
changes, but they are not included in the diff:

  Lib/symbol.py Include/graminit.h Python/graminit.c

References:
http://mail.python.org/pipermail/python-dev/2004-August/047393.
html
(<20040809043104.GA82909@trit.org>) and followups, PEP 328
msg46676 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2004-08-13 14:56
Logged In: YES 
user_id=6380

+1 from a quick glance.

Missing a Misc/NEWS file update.

Suggestion: add "from sys import (*)" to the fail tests.

Please ask Fred to review the parser module changes.

Please ask Jeremy to review the compiler module changes.

Shouldn't there be more docs? Tutorial examples? Etc.

All that can be done after it's checked in.
msg46677 - (view) Author: Dima Dorfman (ddorfman) Date: 2004-08-14 10:14
Logged In: YES 
user_id=908995

Uploaded new patch. Changes:

  - Support trailing comma in from list (suggested by Michael
    Chermside on python-dev). This form is now acceptable:

      from os import (path,)

    but this is not:

      from os import path,

    I originally wanted to support the latter for consistency, but I
    don't think it's necessary (who would want to do that but not use
    parens?) and it's potentially confusing in a case like this:

      from sys import stdin,
      stdout

    which looks like it was intended to be one statement, but the
    second line is actually separate. The way the grammar is written,
    the case with a trailing comma but no parentheses parses okay, but
    it is intentionally rejected by the compiler.

  - Added more success and fail cases, incl. the "import (*)" case.

  - Added NEWS entry. (I'm uncertain whether providing this as part of
    a larger change actually helps; the file changes often enough that
    the patch stands a good chance of not applying cleanly.)

There should definitely be more docs, but I intentionally didn't try
to include unnecessary changes in this patch. As already mentioned,
that can be done later.
msg46678 - (view) Author: Dima Dorfman (ddorfman) Date: 2004-08-24 05:53
Logged In: YES 
user_id=908995

Is this patch waiting on anything else? Should I send out emails 
soliciting reviews from Fred and Jeremey?

Bumped priority since this should go in to the next alpha.
msg46679 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2004-08-24 09:53
Logged In: YES 
user_id=29957

I'll be checking this in shortly.

(aside: please don't monkey with the priority settings...
thanks)
msg46680 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2004-08-31 10:20
Logged In: YES 
user_id=29957

Checked into trunk - will be in Python 2.4a3. Thanks for the
implementation!

/cvsroot/python/python/dist/src/Doc/ref/ref6.tex,v  <-- 
ref6.tex
new revision: 1.72; previous revision: 1.71

/cvsroot/python/python/dist/src/Grammar/Grammar,v  <--  Grammar
new revision: 1.52; previous revision: 1.51

/cvsroot/python/python/dist/src/Include/graminit.h,v  <-- 
graminit.h
new revision: 2.23; previous revision: 2.22

/cvsroot/python/python/dist/src/Lib/symbol.py,v  <--  symbol.py
new revision: 1.18; previous revision: 1.17

/cvsroot/python/python/dist/src/Lib/compiler/transformer.py,v
 <--  transformer.py
new revision: 1.44; previous revision: 1.43

/cvsroot/python/python/dist/src/Lib/test/test_compile.py,v 
<--  test_compile.py
new revision: 1.23; previous revision: 1.22

/cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v 
<--  test_grammar.py
new revision: 1.51; previous revision: 1.50

/cvsroot/python/python/dist/src/Lib/test/test_parser.py,v 
<--  test_parser.py
new revision: 1.20; previous revision: 1.19

/cvsroot/python/python/dist/src/Lib/test/output/test_grammar,v
 <--  test_grammar
new revision: 1.21; previous revision: 1.20

/cvsroot/python/python/dist/src/Misc/NEWS,v  <--  NEWS
new revision: 1.1125; previous revision: 1.1124

/cvsroot/python/python/dist/src/Modules/parsermodule.c,v 
<--  parsermodule.c
new revision: 2.85; previous revision: 2.84

/cvsroot/python/python/dist/src/Python/compile.c,v  <-- 
compile.c
new revision: 2.326; previous revision: 2.325

/cvsroot/python/python/dist/src/Python/future.c,v  <--  future.c
new revision: 2.14; previous revision: 2.13

/cvsroot/python/python/dist/src/Python/graminit.c,v  <-- 
graminit.c
new revision: 2.38; previous revision: 2.37

History
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40743
2004-08-11 11:25:26ddorfmancreate