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/2001-November/018340.html below:

[Python-Dev] Change in evaluation order in new object model

[Python-Dev] Change in evaluation order in new object modelThomas Heller thomas.heller@ion-tof.com
Fri, 2 Nov 2001 19:20:31 +0100
> Andrew described an example of how the descriptor[1] capability will allow 
> Python to be extended in interesting ways.  It turns out to be relatively 
> easy to extend the descriptor capability. I submitted a patch yesterday that 
> adds  support for doc strings and optional type checking to the members 
> defined by slots.  The syntax to add the new capabilities is similar to the 
> __slots__, but uses dictionaries to assign the values.
> 
> class B(object):
>     __slots__ = ['a','b','c']
>     __slot_docs__ = {'a':"doc string for a", 'b' : "doc string for b"}
>     __slot_types__ = {'a':(int,str), 'c':int, }
> 
This is very interesting - I will definitely look at your patch.

This can also be achieved by implementing custom
attribute descriptors, without changes to the core.
You just have to equip the class with them manually.

Currently I'm working on something similar (see http://lpfw.sf.net/, use the
link titled 'Accessing and manipulating C data types').

Thomas




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