This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年06月05日 02:53 by eric.snow, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue15003_public.diff | eric.snow, 2012年06月23日 22:47 | source and doc patch for making PyNamespace_New() public | review | |
| Messages (16) | |||
|---|---|---|---|
| msg162322 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2012年06月05日 02:53 | |
The type is available as types.SimpleNamespace, and there's no reason to hold PyNamespace_New() back. |
|||
| msg162325 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2012年06月05日 03:35 | |
SimpleNamespaces also need to be picklable. |
|||
| msg162330 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2012年06月05日 05:40 | |
Patch to make PyNamespace_New() public. |
|||
| msg162331 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2012年06月05日 06:14 | |
I'll get a patch up tomorrow to make the type pickleable. |
|||
| msg162394 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2012年06月06日 06:35 | |
I'll get to a pickle patch as soon as I can. I also need to add a doc addition for PyNamespace_New() to the existing patch. |
|||
| msg162430 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2012年06月06日 23:27 | |
It would be nice to have a minimum documentation :-) What is the kwds parameter? What are attributes of the object? |
|||
| msg162451 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2012年06月07日 03:20 | |
Where should the docs go for PyNamespace_New()? I looked at what's in Doc/c-api/concrete.rst (concrete.html#other-objects), and each of them points to its own page. Adding a new page for a single function seems a bit too much. :) Would it be bad to put the doc right at the end of concrete.rst? The attached patch does so. (Also just noticed that PyStructSequence_* is not documented...) |
|||
| msg162454 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2012年06月07日 03:39 | |
I've opened issue 15022 for making SimpleNamespace picklable. |
|||
| msg162576 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年06月10日 01:46 | |
> The type is available as types.SimpleNamespace (sorry for being OT) Is this documented in whatsnew? Also, I remember a discussion about making it public or not, but don’t recall a decision. I personally find it bad that we have structseqs for most things, dicts in PEP 418 get_clock_info return values, and now simplenamespace for sys.implementation. |
|||
| msg162661 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2012年06月12日 03:28 | |
> Is this documented in whatsnew? I'm not sure what has been (none of my patches have done so). > Also, I remember a discussion about making it public or not, but > don’t recall a decision. Amaury brought it up in msg162127. His point was that the type is public in Python, so why not the C API? That's about the extent of the discussion. :) Do you see any harm in making PyNamespace_New() public? > I personally find it bad that we have structseqs for most things, dicts > in PEP 418 get_clock_info return values, and now simplenamespace for > sys.implementation. The use cases are different for the different types. StructSequence/namedtuple provides fixed data structures for structured records. A dict is essentially the opposite: an un-fixed data structure for dynamic namespaces, making no firm promises as to what the future holds. SimpleNamespace fills a similar role to dicts, but offers a higher appearance of stability by virtue of using attributes vs. keys. The problem is that moving from item-access to attribute-access is not a backward-compatible change. That's the big reason why PEP 421 specified the use of an attr-based object. |
|||
| msg162675 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年06月12日 13:31 | |
>> Is this documented in whatsnew? > I'm not sure what has been (none of my patches have done so). Okay; if a committer does not add a note we can open a doc bug to not forget that. >> Also, I remember a discussion about making it public or not, but >> don’t recall a decision. > Amaury brought it up in msg162127. His point was that the type is public in Python, so why not the C API? Actually I was talking about making it public at all, i.e. in Python too. > The use cases are different for the different types. StructSequence/namedtuple provides fixed data structures > for structured records. A dict is essentially the opposite: an un-fixed data structure for dynamic namespaces, > making no firm promises as to what the future holds. Right; I just don’t see why the clock info needs to be a dict instead of a structseq or simplenamespace, but maybe it’s explained in the PEP and I missed it. Also it seems to me that the only advantage of simplenamespace over structseqs is that it has no order and can’t be unpacked; I don’t find that a very strong argument (I do see its value, e.g. "major, minor, *etc = sys.version_info" makes sense but we really don’t want to assign order to sys.implementation elements), but I guess this ship has sailed when the implementation was approved. |
|||
| msg163689 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2012年06月23日 22:47 | |
Here's an updated patch to address the use of _PyNamespace_New() in changeset 77414:0011536f2a06. |
|||
| msg163741 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年06月24日 07:23 | |
-1. The entire Python API is already accessible from C, so expansions to the public C API need more justification than "it's exposed in Python". If new instances of this type end up being used in performance critical third party C extensions, then we can have a conversation about whether or not it needs to be exposed directly in C. |
|||
| msg163819 - (view) | Author: Mark Shannon (Mark.Shannon) * (Python committer) | Date: 2012年06月24日 19:00 | |
-1 for the reasons Nick stated. |
|||
| msg164547 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年07月02日 20:51 | |
Suggest closing or marking "remind" and see if people use / request / reimplement SimpleNamespace. |
|||
| msg182240 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2013年02月16日 21:21 | |
At present, I don't see a need to make the C API public. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:31 | admin | set | github: 59208 |
| 2021年05月13日 00:34:19 | vstinner | set | nosy:
- vstinner resolution: rejected |
| 2021年05月12日 23:00:49 | joukewitteveen | set | nosy:
+ joukewitteveen |
| 2013年02月16日 21:21:31 | eric.snow | set | status: open -> closed messages: + msg182240 |
| 2012年07月02日 20:51:08 | eric.araujo | set | messages:
+ msg164547 versions: + Python 3.4, - Python 3.3 |
| 2012年06月24日 19:00:37 | Mark.Shannon | set | nosy:
+ Mark.Shannon messages: + msg163819 |
| 2012年06月24日 07:23:28 | ncoghlan | set | nosy:
+ ncoghlan messages: + msg163741 |
| 2012年06月23日 22:48:31 | eric.snow | set | files: - issue15003_public.diff |
| 2012年06月23日 22:47:59 | eric.snow | set | files:
+ issue15003_public.diff messages: + msg163689 |
| 2012年06月12日 13:31:52 | eric.araujo | set | messages: + msg162675 |
| 2012年06月12日 03:28:29 | eric.snow | set | messages: + msg162661 |
| 2012年06月10日 01:46:23 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg162576 |
| 2012年06月07日 07:36:49 | eric.snow | set | stage: needs patch -> patch review |
| 2012年06月07日 03:39:01 | eric.snow | set | messages: + msg162454 |
| 2012年06月07日 03:20:07 | eric.snow | set | files:
+ issue15003_public.diff messages: + msg162451 |
| 2012年06月07日 03:18:32 | eric.snow | set | files: - issue15003_public.diff |
| 2012年06月06日 23:27:56 | vstinner | set | nosy:
+ vstinner messages: + msg162430 |
| 2012年06月06日 06:35:22 | eric.snow | set | messages: + msg162394 |
| 2012年06月05日 06:14:10 | eric.snow | set | messages: + msg162331 |
| 2012年06月05日 05:40:11 | eric.snow | set | files:
+ issue15003_public.diff keywords: + patch messages: + msg162330 |
| 2012年06月05日 03:35:22 | rhettinger | set | nosy:
+ rhettinger messages: + msg162325 |
| 2012年06月05日 02:53:39 | eric.snow | create | |