[Python-ideas] Mitigating 'self.' Method Pollution
Steven D'Aprano
steve at pearwood.info
Sat Jul 11 19:29:29 CEST 2015
On Sat, Jul 11, 2015 at 01:16:41PM -0400, Ron Adam wrote:
> What would this do?
>
> def __init__(self, red, blue, green):
> self red, blue green
> red = red
> blue = blue
> green = green
I would expect it to raise a SyntaxError, just like this:
py> def f(a):
... global a
...
File "<stdin>", line 1
SyntaxError: name 'a' is local and global
--
Steve
More information about the Python-ideas
mailing list