Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue35911

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:add a cell construtor, and expose the cell type in Lib/types.py
Type:enhancementStage:resolved
Components:Versions:Python 3.8
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: pierreglaser, pitrou, serhiy.storchaka, yselivanov
Priority:normalKeywords:patch

Created on2019-02-06 10:55 bypierreglaser, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
cell.patchpierreglaser,2019-02-06 10:55
test_cell.pypierreglaser,2019-02-06 10:57
Pull Requests
URLStatusLinkedEdit
PR 11771mergedpierreglaser,2019-02-06 16:37
PR 11771mergedpierreglaser,2019-02-06 16:37
Messages (3)
msg334924 -(view)Author: Pierre Glaser (pierreglaser)*Date: 2019-02-06 10:55
cell objects are containers for the free variables of functions defined in alocal scope. They are located in a function's __closure__ attribute (whenit is not None). A cell is a very simple object, with a single (optional, e.gthe cell can be empty) attribute: cell_contents.The C/Python API provides a constructor to create such objects (PyCell_New).However no cell.__new__ method is exposed to the pure python user. Workaroundsexist, but are hacky, and involve the creation of intermediate, unusedfunctions.Why would cell-creation be useful? because creating cells happens in pickleextensions modules designed to save user-defined functions and classes(https://github.com/cloudpipe/cloudpickle) (*).  These moudules are dependencies ofmany widely-used data science frameworks (pyspark, ray, dask). Exposing a cellconstructor will simplify theses extensions code base, and alleviate theirmaintenance cost.I propose to add and expose a simple cell constructor, that accepts 0 (emptycells) or 1 arguments. I also propose to expose the cell type inLib/types.py(as types.CellType)(*): see related issues:https://bugs.python.org/issue35900
msg334931 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2019-02-06 11:53
Hi Pierre,You'll want to submit your patch as a GitHub pull request.Also your PR will have to contain:- tests for the new Python-facing API- documentation for the new APIYou may want to read more in the developer's guide:https://devguide.python.org/
msg335037 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2019-02-07 19:36
New changesetdf8d2cde63c865446468351f8f648e1c7bd45109 by Antoine Pitrou (Pierre Glaser) in branch 'master':bpo-35911: add cell constructor (GH-11771)https://github.com/python/cpython/commit/df8d2cde63c865446468351f8f648e1c7bd45109
History
DateUserActionArgs
2022-04-11 14:59:10adminsetgithub: 80092
2019-02-07 19:37:16pitrousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-02-07 19:36:58pitrousetmessages: +msg335037
2019-02-06 16:37:43pierreglasersetstage: patch review
pull_requests: +pull_request11739
2019-02-06 16:37:33pierreglasersetstage: (no value)
pull_requests: +pull_request11738
2019-02-06 11:53:28pitrousetmessages: +msg334931
2019-02-06 11:50:52pitrousetnosy: +serhiy.storchaka
2019-02-06 10:57:14pierreglasersetfiles: +test_cell.py
2019-02-06 10:55:47pierreglasercreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp