A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-December/010896.html below:

Are you all mad? (Re: [Python-Dev] PEP 231, __findattr__())

Are you all mad? (Re: [Python-Dev] PEP 231, __findattr__())greg@cosc.canterbury.ac.nz greg@cosc.canterbury.ac.nz
Wed, 06 Dec 2000 12:07:06 +1300 (NZDT)
I can't believe you're even considering a magic
dynamically-scoped flag that invisibly changes the
semantics of fundamental operations. To me the
idea is utterly insane!

If I understand correctly, the problem is that if
you do something like

  def __findattr__(self, name):
    if name == 'spam':
      return self.__dict__['spam']

then self.__dict__ is going to trigger a recursive
__findattr__ call. 

It seems to me that if you're going to have some sort
of hook that is always called on any x.y reference,
you need some way of explicitly bypassing it and getting
at the underlying machinery.

I can think of a couple of ways:

1) Make the __dict__ attribute special, so that accessing
it always bypasses __findattr__.

2) Provide some other way of getting direct access to the
attributes of an object, e.g. new builtins called
peekattr() and pokeattr().

This assumes that you always know when you write a particular
access whether you want it to be a "normal" or "special"
one, so that you can use the appropriate mechanism.
Are there any cases where this is not true?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4