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.

Author pierreglaser
Recipients pierreglaser, pitrou, yselivanov
Date 2019-02-06.10:55:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1549450547.33.0.317079200708.issue35911@roundup.psfhosted.org>
In-reply-to
Content
cell objects are containers for the free variables of functions defined in a
local scope. They are located in a function's __closure__ attribute (when
it is not None). A cell is a very simple object, with a single (optional, e.g
the 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. Workarounds
exist, but are hacky, and involve the creation of intermediate, unused
functions.

Why would cell-creation be useful? because creating cells happens in pickle
extensions modules designed to save user-defined functions and classes
(https://github.com/cloudpipe/cloudpickle) (*).  These moudules are dependencies of
many widely-used data science frameworks (pyspark, ray, dask). Exposing a cell
constructor will simplify theses extensions code base, and alleviate their
maintenance cost.

I propose to add and expose a simple cell constructor, that accepts 0 (empty
cells) or 1 arguments. I also propose to expose the cell type in Lib/types.py
(as types.CellType)


(*): see related issues: https://bugs.python.org/issue35900
History
Date User Action Args
2019-02-06 10:55:51pierreglasersetrecipients: + pierreglaser, pitrou, yselivanov
2019-02-06 10:55:47pierreglasersetmessageid: <1549450547.33.0.317079200708.issue35911@roundup.psfhosted.org>
2019-02-06 10:55:47pierreglaserlinkissue35911 messages
2019-02-06 10:55:47pierreglasercreate