Dev:2.4/Source/Python/API/GeneralRanting
< Dev:2.4 | Source | Python | API
2010年5月27日 (木) 17:24時点におけるwiki>Mindrones botによる版 (Bot: Fixing redirects)
Back to Topic: BpyApiDiscussion
This seems like a good place to hide this comment.
- Shouldn't the bpy objects be written in a more Pythonic style?
- For instance in Python you rarely see getters and setters. If you want to get the value of an attribute you just use spam.attrib, and if you want to set it you say spam.attrib = foo. All the getting and setting is handled by the object providing the attribute.
- A long, long time ago in a galaxy much like this one, getters and setters was the only way to set attrbutes for types. Nowadays, python is smarter and so are we. Currently, as part of the API Cleanup, we are implementing just this sort of attribute access. All Praise to the tp_getset slot in PyTypeObject. -- StephenSwaney - 17 Aug 2005
- For instance in Python you rarely see getters and setters. If you want to get the value of an attribute you just use spam.attrib, and if you want to set it you say spam.attrib = foo. All the getting and setting is handled by the object providing the attribute.
- A thought I've had before is that it might be easyer to only expose a very low level interface to Blender, and then to have python modules built on top of this. I belive this is the way python interfaces a generally written (see _tkinter and Tkinter). Anyway I'm not one to talk as I wont be contributing to the C side, just giving some suggestions. -- EdBlake - 23 Jun 2005