[Python-Dev] PEP 409 update [was: PEP 409 - final?]

Terry Reedy tjreedy at udel.edu
Sat Feb 4 01:23:41 CET 2012


On 2/3/2012 9:53 AM, Yury Selivanov wrote:
> Re "raise ValueError from ..."

The use cases for Ellipsis/... are 99.99% internal. The typical Python 
programmer will never see or have cause to worry about such a thing.

The problem is that we really want an exception attribute that is 
missing in certain cases. But C does not allow missing struct members 
(the corresponding block of memory *will* have some bit pattern!). So
unset attributes requires a dict instead of slots (I am presuming each 
builting exception class uses slots now) and the use of the C equivalent 
of hasattr (or try: except:) and delattr.

So instead the proposal is to use a marker value that effectively means 
'unset' or 'unspecified'. But what? None cannot be used because it is 
being used as a set value. Ethan initially proposed 'False', but then 
realizaed that 'True' fits as well, so neither fit. I proposed a new 
internal exception class primarily to get us thinking about alternatives 
to True/False.

Ellipsis, properly understoo, comes close to meaning 'unspecified'. My 
memory is that that it how it is used in NumPy slicings. The manual 
gives no meaning for Ellipsis, only saying that it is used in slicings. 
The linked slicings section does not mention it.

Ethan: I think the PEP should say more about ... being a grammatical 
placeholder in English, much like 'pass' is in Python. Otherwise, we 
will see periodic posts objecting to it in python-list.

-- 
Terry Jan Reedy



More information about the Python-Dev mailing list