Inserting class namespace into method scope

Ben Finney ben+python at
Sat Nov 20 22:59:30 CET 2010

Steven D'Aprano <steve at> writes:

> I also understand that the usual way of getting this would be to
> return self.x or self.__class__.x from method, instead of x. Again,
> normally I would do this.
> But in this specific case I have reasons for wanting to avoid both of
> the normal behaviours. Do not judge me, please accept that I have a
> good reason for wanting this

C'mon, Steven, you know the drill. If you want us to help you solve a
problem, don't start with “I want to use this behaviour that seems
loony, and I won't say why”. Instead, help us by telling us what problem
you're trying to solve.

It's not good enough to simply say “I can't do it the right way”, you
need to let us in on what the problem actually is, otherwise we have to
play twenty questions with “okay, how about this” “no, that's no good
either for other unspecified reasons”.

So: what problem are you trying to solve, and what are the constraints?

 \         “The double standard that exempts religious activities from |
  `\       almost all standards of accountability should be dismantled |
_o__)                   once and for all.” —Daniel Dennett, 2010-01-12 |
Ben Finney

More information about the Python-list mailing list