Dear all,

I would like to know your opinion on how to address a specific need of
the new PEP 637:

https://github.com/python/peps/blob/master/pep-0637.txt

Such PEP would make a syntax like the following valid

    obj[2, x=23]
    obj[2, 4, x=23]

Which would resolve to a call in the form

    type(obj).__getitem__(obj, 2, x=23)
    type(obj).__getitem__(obj, (2, 4), x=23)

and similar for set and del.
After discussion, we currently have one open point we are unsure how
to address, that is what to pass when no positional index is passed,
that is:

    obj[x=23]

We are unsure if we should resolve this call with None or the empty
tuple in the positional index:

    type(obj).__getitem__(obj, None, x=23)
    type(obj).__getitem__(obj, (), x=23)

You can see a detailed discussion in the PEP at L913

https://github.com/python/peps/blob/1fb19ac3a57c9793669ea9532fb840861d4d7566/pep-0637.txt#L913

One of the commenters on python-ideas reported that using None might
introduce an issue in numpy, as None is used to create new axes, hence
the proposal for rejection of None as a solution.
However, we are unsure how strongly this would affect numpy and
similar packages, as well as what developer will find more natural to
receive in that case. We would like to hear your opinion on the topic.

Thank you for your help.


-- 
Kind regards,

Stefano Borini
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to