Re: Frustrated with scopes

2009-08-12 Thread andrew cooke
On Aug 12, 8:52 am, Dave Angel 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

Re: Frustrated with scopes

2009-08-12 Thread Dave Angel
andrew cooke wrote: 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): @staticmethod def __call__(lines, source, join=''.join): class Line(object): __source

Re: Frustrated with scopes

2009-08-12 Thread Steven D'Aprano
On Wed, 12 Aug 2009 04:49:06 -0700, andrew cooke wrote: >> It would be helpful if you were to describe the type of behavior you >> expect. > > Sorry, I didn't make myself clear. When run the code gives > NameError: name 'source' is not defined > because the class namespace blocks the function n

Re: Frustrated with scopes

2009-08-12 Thread Diez B. Roggisch
andrew cooke wrote: > On Aug 12, 7:49 am, andrew cooke wrote: >> On Aug 12, 1:51 am, James Stroud >> wrote: >> >> >> >> > andrew cooke wrote: >> > > Is there a way to make this work (currently scope and join are >> > > undefined at runtime when the inner class attributes are defined): >> >> > >

Re: Frustrated with scopes

2009-08-12 Thread andrew cooke
On Aug 12, 7:49 am, andrew cooke wrote: > On Aug 12, 1:51 am, James Stroud > wrote: > > > > > andrew cooke wrote: > > > 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): > >

Re: Frustrated with scopes

2009-08-12 Thread andrew cooke
On Aug 12, 1:51 am, James Stroud wrote: > andrew cooke wrote: > > 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): > > >     @staticmethod > >     def __call__(lines, source, jo

Re: Frustrated with scopes

2009-08-11 Thread James Stroud
James Stroud wrote: > def stream_factory: > class Line(object): > __source = source > __join = join > # etc. > return Line > of course I meant "def stream_factory(lines, source, join=''.join):" James -- http://mail.python.org/mailman/listinfo/python-list

Re: Frustrated with scopes

2009-08-11 Thread James Stroud
andrew cooke wrote: 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): @staticmethod def __call__(lines, source, join=''.join): class Line(object): __source

Re: Frustrated with scopes

2009-08-11 Thread andrew cooke
correction: "source" and "join" are undefined. Sorry, Andrew -- http://mail.python.org/mailman/listinfo/python-list

Frustrated with scopes

2009-08-11 Thread andrew cooke
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): @staticmethod def __call__(lines, source, join=''.join): class Line(object): __source = source