descriptor Questions
2
Solved
I am writing a Python wrapper class for a C# API accessed through Pythonnet.
As I want to extend the API with my own methods I decided to wrap it using the composition approach outlined here:
The C...
Winfordwinfred asked 12/4, 2016 at 18:8
3
Solved
I've just ran into the descriptors in Python, and I got the ideas about the descriptor protocol on "__get__, __set__, __delete__", and it really did a great job on wrapping methods.
However, in th...
Spongy asked 27/1, 2016 at 7:28
1
Solved
I am currently revisiting a project using Google Protocol Buffers.
In the project I want to make use of the features Descriptors and Reflection of Protocol Buffers.
The official documentation sta...
Smithson asked 23/9, 2015 at 14:40
2
Solved
Where can I find the declaration of type FILE in sources files?
I can't find it in stdio.h. I mean the declaration of it.
Is it int type? File description? Or is it a structure?
I need to implement...
Selia asked 16/9, 2015 at 10:54
1
Solved
Currently going through microsofts examples, it is noticable, that only one cbv_srv_uav heap is used per commandlist (+ maybe on additional sampler heap).
Is it possible to use multiple heaps per ...
Malina asked 20/8, 2015 at 9:12
3
Solved
I've seen this quite often:
def __get__(self, instance, owner=None):
Why do some people use the default value of None for the the owner parameter?
This is even done in the Python docs:
descr._...
Digged asked 25/7, 2015 at 12:53
4
Why does this throw a KeyError:
d = dict()
d['xyz']
But this does not?
d = dict()
d.get('xyz')
I'm also curious if descriptors play a role here.
Qualification asked 21/5, 2015 at 2:28
2
I know that in Python we have to supply __get__ function when implementing a descriptor. The interface is like:
def __get__(self, obj, objtype=None):
pass
My question is:
Why we have to...
Winni asked 25/5, 2015 at 8:34
1
Solved
I am trying to understand descriptors better.
I don't understand why in the foo method the descriptors __get__ method doesn't get called.
As far as I understand descriptors the __get__ method alw...
Estivate asked 28/4, 2015 at 20:41
1
Solved
I get the following example from Effective Python item 31:
from weakref import WeakKeyDictionary
class Grade(object):
def __init__(self):
self._values = WeakKeyDictionary()
def __get__(self, in...
Cosby asked 3/4, 2015 at 17:14
5
Solved
I want to create an object in python that has a few attributes and I want to protect myself from accidentally using the wrong attribute name. The code is as follows:
class MyClass( object ) :
m =...
Belligerency asked 4/5, 2009 at 15:50
3
I am trying to use opencv with python. I wrote a descriptor (SIFT, SURF, or ORB) matching code in C++ version of opencv 2.4. I want to convert this code to opencv with python. I found some document...
Aeolic asked 20/6, 2012 at 6:57
3
Solved
I'm having a hard time understanding what happens when I try to nest descriptors/decorators. I'm using python 2.7.
For example, let's take the following simplified versions of property and classme...
Alost asked 22/3, 2013 at 23:11
1
Solved
When I make the "data" variable a class variable, the following works, but when I make it an object variable, the descriptor is not called. Please help.
class Data(object):
products = {
'milk': ...
Illustrate asked 26/4, 2014 at 10:39
1
Solved
A common design pattern when using python descriptors is to have the descriptor keep a dictionary of instances using that descriptor. For example, suppose I want to make an attribute that counts th...
Doglike asked 12/4, 2014 at 23:44
2
Solved
The question refers to which one is preferable to be used in which use case, not about the technical background.
In python, you can control the access of attributes via a property, a descriptor, o...
Tripinnate asked 24/3, 2014 at 17:34
2
Solved
I just updated my Eclipse from Galileo to Juno. I created a new workspace and imported a Java Spring MVC based project. When I open it, it begins 'Loading descriptor' and then an error message pops...
Garygarza asked 11/10, 2012 at 17:15
3
Solved
In class B below I wanted the __set__ function in class A to be called whenever you assign a value to B().a . Instead, setting a value to B().a overwrites B().a with the value. Class C assigning to...
Clausen asked 16/6, 2009 at 21:55
2
Solved
I have a problem with a program I am writing and i cannot for the life of me figure out what I am doing wrong.
Ok so basically I am writing a program to extract data from an XML document and manip...
Acceptance asked 7/3, 2014 at 19:54
2
Solved
In Python 3
class A(object):
attr = SomeDescriptor()
...
def somewhere(self):
# need to check is type of self.attr is SomeDescriptor()
desc = self.__class__.__dict__[attr_name]
return isinst...
Selfinterest asked 7/2, 2014 at 13:46
2
I am trying to use use a list to reference a sequence of descriptors without success. There are a list of objects (_b) defined by an external library (class A) that I would like to access via descr...
Resnick asked 19/11, 2012 at 2:50
1
Solved
I tried to google something about it. Why do non-data descriptors work with old-style classes?
Docs say that they should not:
"Note that descriptors are only invoked for new style objects or class...
Konopka asked 23/5, 2013 at 10:50
1
Solved
Recently I read the official HOW-TO about Python descriptors, which actually derives from an essay written by Raymond Hettinger long time ago. But after reading it for several times, I am still con...
Rieger asked 19/4, 2013 at 6:18
1
Solved
Python functions have a descriptors. I believe that in most cases I shouldn't use this directly but I want to know how works this feature? I tried a couple of manipulations with such an objects:
...
Plum asked 10/2, 2013 at 16:29
3
Solved
I am now using ASM (Java bytecode instrumentation library). To retrieve the signature of given method, there is a field which is named "desc". I guess this is an abbreviation of "descriptor", but w...
Jeopardize asked 23/9, 2011 at 8:52
© 2022 - 2024 — McMap. All rights reserved.