A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-March/062899.html below:

[Python-Dev] PySet API

[Python-Dev] PySet API [Python-Dev] PySet APIGreg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 28 07:28:57 CEST 2006
Barry Warsaw wrote:
> My PySet_Clear() raises a SystemError
> and returns -1 when the object is a frozen set.

Isn't SystemError a bit drastic? TypeError would be
sufficient here, surely.
> 
> If PyObject_Clear() is implemented something like
> 
> int PyObject_Clear(PyObject *o)
> {
>     return (o->ob_type->tp_clear ? o->ob_type->tp_clear(o) : -1);
> }
> 
> then you /would/ be able to clear a frozen set.

Hmmm, the problem here, I think, is that tp_clear is
really only designed for use by the garbage collector.
Giving anything else access to it is probably wrong.

Clearability is not a general feature in Python land --
a few types have a clear() method, but this is an
ad hoc feature of the type concerned. I don't think
it makes sense to have a general PyObject_Clear
function at all.

--
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4