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/2003-May/035788.html below:

[Python-Dev] Descriptor API

[Python-Dev] Descriptor API [Python-Dev] Descriptor APIGonçalo Rodrigues op73418@mail.telepac.pt
Wed, 21 May 2003 01:41:16 +0100
I was doing some tricks with metaclasses and descriptors in Python 2.2 and
stumbled on the following:

>>> class test(object):

...             a = property(lambda: 1)

...

>>> print test.a

<property object at 0x01504D20>

>>> print test.a.__set__

<method-wrapper object at 0x01517220>

>>> print test.a.fset

None



What this means in practice, is that if I want to test if a descriptor is
read-only I have to have two tests: One for custom descriptors, checking
that getting __set__ does not barf and another for property, checking that
fset returns None.



So, why doesn't getting __set__  raise AttributeError in the above case?



Is this a bug? If it's not, it sure is a (minor) feature request from my
part :-)



With my best regards,

G. Rodrigues





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