from-import on non-module objects?

Hamish Lawson hamish_lawson at yahoo.co.uk
Wed Jan 31 12:58:08 EST 2001


Have there been thoughts on having from-import used on non-module
objects in order to introduce attributes from a given object into the
current scope? Here's an example of its possible use (not that I
actually want to get round using 'self' in methods - I actually like
its explicitness):

    class AClass:

        def __init__(self, x, y):
            self.x = x
            self.y = y

        def output(self):
            from self import *
            print x, y


Hamish Lawson


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list