Issue1759

classification
Title: bug: return as attribute? [2.5.2 and earlier]
Type: Severity: normal
Components: Core Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: babelmania, fwierzbicki
Priority: Keywords:

Created on 2011-06-15.08:06:31 by babelmania, last changed 2013-02-26.18:04:26 by fwierzbicki.

Messages
msg6551 (view) Author: Jorgo Bakker (babelmania) Date: 2011-06-15.08:06:31
Consider the following code
<<<
class Foo:
    def __init__(self):
        self.return=1
        self.other=2
        return

    pass

foo=Foo()
print foo.return
<<<

Jython accepts and executes this code, but I believe it is wrong as it uses a reserved word.
msg7795 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-26.18:04:26
Thanks for the bug report! The code with "self.return" does look funny. We support the use of keywords after a dot on purpose because Jython translates Java code like:
Foo.getReturn()

to Foo.return

So this is a concession to our design.
History
Date User Action Args
2013-02-26 18:04:26fwierzbickisetstatus: open -> closed
resolution: wont fix
messages: + msg7795
nosy: + fwierzbicki
2011-06-15 08:06:47babelmaniasetcomponents: + Core
2011-06-15 08:06:31babelmaniacreate