On 12/12/05, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> Unfortunately that fails one of the other requirements, which (at the
> time of implementation) was minimal impact on the rest of the
> interpreter. Since __private isn't limited to self, and attribute
> lookup doesn't always result in a dict lookup, this would require a
> complete overhaul of the getattr API, both at the C and at the Python
> level.
I hate to flog a dead horse but I feel it's important to clarify my
intentions here. I don't see why it couldn't require a dict.
Immutable builtins will fail either way, and so will classes using
slots (unless they hardcode the required private name). The only
problematic use-case I can think of is a proxy class, but is that
enough to dictate the entire design of the feature?
> But I guess you already said that when you said """Obviously it
> doesn't handle backwards compatibility, so it's more of a "if I could
> do it again.." suggestion."""
I was referring to code which already hardcodes the format of the
current approach, i.e.:
class Foo(object):
def __init__(self):
self.__private = 42
f = Foo()
print f._Foo__private
--
Adam Olsen, aka Rhamphoryncus
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com