Frustrated with scopes

andrew cooke andrew at
Wed Aug 12 04:13:39 CEST 2009

Is there a way to make this work (currently scope and join are
undefined at runtime when the inner class attributes are defined):

class _StreamFactory(object):

    def __call__(lines, source, join=''.join):

        class Line(object):

            __source = source
            __join = join

I can get something working by bouncing through global values, but it
looks awful and I think it's a source of a bug due too values being


More information about the Python-list mailing list