[Numpy-discussion] Stacklevel for warnings.

Sebastian Berg sebastian at sipsolutions.net
Sat Aug 11 04:22:50 EDT 2018


On Fri, 2018-08-10 at 16:05 -0600, Charles R Harris wrote:
> Hi All,
> 
> Do we have a policy for the stacklevel that should be used in NumPy?
> How far back should the stack be displayed? I note that the optimum
> stacklevel may vary between users and developers.
> 

I thought it was so that it will point to the correct user line (or
tend to point there). So stacklevel=2 for exposed and higher for
private (python) functions IIRC.
As for developers, I would hope they are OK with (and know how to)
turning the warning into an error.

Not sure we discussed it much, I seem to have a vague memory of asking
if we are sure this is what we want and at least Ralf agreeing. Also I
don't know how consistent it is overall.

- Sebastian


> Chuck
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180811/505f42bb/attachment.sig>


More information about the NumPy-Discussion mailing list