Frustrated with scopes

andrew cooke andrew at acooke.org
Wed Aug 12 09:47:38 EDT 2009


On Aug 12, 8:52 am, Dave Angel <da... at ieee.org> wrote:
> Supply us with just enough source code to actually try it, give the full
> error message including traceback, and tell us what you expected to
> see.  Also tell us Python version   (sys.version)
>
> So far you've done none of these.  When I try the following, I get no
> errors, using Python 2.6.2
>
> class _StreamFactory(object):
>
>     @staticmethod
>     def __call__(lines, source, join=''.join):
>
>         class Line(object):
>
>             __source = source
>             __join = join
>         return Line()
>
> fact = _StreamFactory()
> obj = fact(43, "name.txt")
> print obj

Ah!  OK, thanks for that.  I need to look at this again.  I'll post
again if necessary, but if it works for you then I clearly don't
understand what the issue is myself.

Andrew



More information about the Python-list mailing list