spell method chaining?

Just van Rossum just at letterror.com
Sat Jun 9 04:02:56 EDT 2001


Robin Becker wrote:
> 
> In article <3B2111FF.D998EEE4 at letterror.com>, Just van Rossum
> <just at letterror.com> writes
> ....
> >s inheriting it)
> >
> >You can avoid that by spelling it like this:
> >
> >def gen(B):
> >   class W(B):
> >      __base = B
> >      def __init__(self):
> >         self.__base.__init__(self)
> >   return W
> >
> >Just
> this nearly works fine in 2.1 if I have a from __future__ import
> nested_scopes, but gives a shadowed variable warning if not.

Sorry: I made made the unforgivable mistake to not _run_ the code I posted... Duh.
Major braino. (Sorry also to Remco -- I should've known better ;-)

But: it seems it's really hard to do what you want either with or without
nested scopes. How about telling us what you really want to accomplish --
maybe there's a different way!

Just



More information about the Python-list mailing list