should "self" be changed?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Wed May 27 01:20:41 EDT 2015
On Wednesday 27 May 2015 05:46, Marko Rauhamaa wrote:
> Python's practice works. However, a small problem is presented by nested
> classes:
>
> class Connection:
> def __init__(self):
> class Idle:
> def signal_start(self):
> # how to refer to the outer self
> :
> :
The best solution is not to use nested classes, but if you really must:
class Connection:
def __init__(self):
class Idle:
def signal_start(this):
# this is the Idle instance;
# self is the Connection instance
--
Steve
More information about the Python-list
mailing list