import x as y

Thomas Wouters thomas at xs4all.net
Mon Oct 30 05:38:06 EST 2000


On Sun, Oct 29, 2000 at 05:44:07PM -0800, Grant Munsey wrote:

> Just converted over to 2.0. Import x as y is SO DARN COOL!!!

Thanx :)

(Not my idea, nor my implementation tricks, but my code for sure ;)

As a side note, I also proposed another extention (which would be hella easy
to code -- it's a 2-line change, IIRC) that allowed any assignment
expression on the right hand side of the 'as', like so:

d = {}
import string as d['string'] # store directly in dict, not in local namespace

and

from sys import version_info as (maj, min, pl, type, relno) # unpack tuple

and

import shelve
from myoptimizedCPickle import Pickler as shelve.Pickler # store in shelve

all for free ;) I wasn't able to persuade Guido this was a good thing,
though, but I didn't really try hard. Anyone else want to give it a try ? :)
The patch can be found on SourceForge, still:

http://sourceforge.net/patch/?func=detailpatch&patch_id=101234&group_id=5470

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list