inner classes in python as inner classes in Java
Carlo v. Dango
oest at soetu.eu
Thu Oct 16 03:48:52 EDT 2003
On Wed, 15 Oct 2003 22:20:44 GMT, Alex Martelli <aleaxit at yahoo.com> wrote:
>> __setattr__ will have no changes of knowing when to create the field or
>> look it up in the outer scope... this suxx man... I never understood the
>> smart thing about that feature in python.. anyone care to enlighten me?
>
> If you can't see that it's simpler to let
>
> target = value
>
> have the same semantics whether target was already bound to something
> or not, it's hard to see what will convince you.
I can't... mispelling occours and leed to stupid bugs rather than compile
errors which are simple to check. Even smalltalk has this feature..
> its still hard to say what benefits you'll be getting, of course, but
> there
> may be some cunning plan behind it all.
aaaah come on :) you really cannot see the nice things of having a scope
for inner class instances?? It's like inner method.. atleast they share
scope with their outer method... if it didn't it would render inner
methods almost useless..
class A(object):
def foo(self):
i = 3
def bar():
print i
bar()
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
More information about the Python-list
mailing list