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/2007-February/071221.html below:

[Python-Dev] Wrapping up 'dynamic attribute' discussion

[Python-Dev] Wrapping up 'dynamic attribute' discussion [Python-Dev] Wrapping up 'dynamic attribute' discussionGreg Falcon veloso at verylowsodium.com
Fri Feb 16 05:00:01 CET 2007
On 2/15/07, Anthony Baxter <anthony at interlink.com.au> wrote:
> On Friday 16 February 2007 09:08, Ben North wrote:
> > The wrapper class idea was left
> > open as a possibility for a future PEP.
>
> A good first step would be to contribute something like this to the
> Python Cookbook, if it isn't already there.

I could not find such a class in the cookbook.  (That's not to say
there's not one there that I missed.)

Because I think attrview() should happen, I submitted a recipe to the
Python Cookbook.  While it awaits editor approval, I have it posted at
http://www.verylowsodium.com/attrview.py .

One possibly controversial design choice here: since there is no
guaranteed way to enumerate attributes in the face of __getattr__ and
friends, my version of attrview() does not provide iteration or any
other operation that assumes object attributes can be enumerated.
Therefore, it technically does not implement a mapping.

Once Python grows a __dir__ special method, it's possible I could be
convinced this is the wrong choice, but I'm not sure of that.

Greg F
More information about the Python-Dev mailing list

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