<div dir="ltr">Thanks for info!<div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div>Kind Regards,</div><div dir="ltr"><br></div><div dir="ltr">Abdur-Rahmaan Janhangeer<div><a href="https://www.compileralchemy.com" target="_blank">compileralchemy.com</a> | <a href="https://github.com/Abdur-rahmaanJ/" target="_blank">github</a><br></div><div>Mauritius</div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 23, 2020 at 10:56 PM Chris Barker <<a href="mailto:chris.barker@noaa.gov">chris.barker@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Thu, Mar 5, 2020 at 2:15 PM Gregory Lee <<a>grlee77@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>If i can get a link to a file that shows how dunder methods help with having cool coding APIs that would be great!</div><div><br></div></div></blockquote><div><br></div><div><div>You may want to take a look at PEP 465 as an example, then. If I recall correctly, the __matmul__ method described in it was added to the standard library largely with NumPy in mind.<br></div><div><a>https://www.python.org/dev/peps/pep-0465/</a></div></div></div></div></blockquote><div><br></div><div>and so were "rich comparisons", and in-place operators (at least in part).</div><div><br></div><div>numpy is VERY, VERY, heavily built on the concept of overloading operators, i.e. using dunders or magic methods.</div><div><br></div><div>I'm going to venture a guess that numpy arrays custom define every single standard dunder -- and certainly most of them.</div><div><br></div><div>-CHB</div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 5, 2020 at 10:32 PM Sebastian Berg <<a>sebastian@sipsolutions.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
On Thu, 2020-03-05 at 11:14 +0400, Abdur-Rahmaan Janhangeer wrote:<br>
> Greetings list,<br>
> <br>
> I have a talk about dunder methods in Python <br>
> <br>
> (<br>
> <a rel="noreferrer">https://conference.mscc.mu/speaker/67604187-57c3-4be6-987c-ea4bef388ad3</a><br>
> ) <br>
> <br>
> and it would be nice to include Numpy in the mix. Can someone point<br>
> me to one or two use cases / file link where dunder methods help<br>
> numpy? <br>
> <br>
<br>
I am not sure in what sense you are looking for. NumPy has its own set<br>
of dunder methods (some of which should not be used super much<br>
probably), like `__array__`, `__array_interface__`, `__array_ufunc__`,<br>
`__array_function__`, `__array_finalize__`, ...<br>
So we are using `__array_*__` for numpy related dunders.<br>
<br>
Of course we use most Python defined dunders, but I am not sure that<br>
you are looking for that?<br>
<br>
Best,<br>
<br>
Sebastian<br>
<br>
<br>
> Thanks<br>
> <br>
> fun info: i am a tiny numpy contributor with a one line merge.<br>
> _______________________________________________<br>
> NumPy-Discussion mailing list<br>
> <a>NumPy-Discussion@python.org</a><br>
> <a rel="noreferrer">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a>NumPy-Discussion@python.org</a><br>
<a rel="noreferrer">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a>NumPy-Discussion@python.org</a><br>
<a rel="noreferrer">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div></div>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a>NumPy-Discussion@python.org</a><br>
<a rel="noreferrer">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R (206) 526-6959 voice<br>7600 Sand Point Way NE (206) 526-6329 fax<br>Seattle, WA 98115 (206) 526-6317 main reception<br><br><a>Chris.Barker@noaa.gov</a></div></div>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a>NumPy-Discussion@python.org</a><br>
<a rel="noreferrer">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>