Re: Best practices regarding partial import of hand-selected functions into global namespace
David Nicholson <[email protected]> Tue, 22 Mar 2022 17:08:06 -0400
| Newsgroups | gmane.comp.python.scientific.user |
|---|---|
| Message-ID | <CAMabFbW8B2uCoH_5NQ64bg72_ckOMbRBipU9jPpaVc7g0aF1qA@mail.gmail.com> |
--===============9091779820416647762==
Content-Type: multipart/alternative; boundary="0000000000001a63bb05dad5032e"
--0000000000001a63bb05dad5032e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
>
> Thank you David, I don't think referencing PEP8 is pedantic at all and I
> appreciate the response.
=F0=9F=91=8D
As you say, in some sense it is just a regular Python style question and
> usually the best answer is just to do `import module`. Perhaps it is also
> best to just do that with scipy as well, or else you end up with this
> ridiculously long `from scipy.linalg import ___, ___, ___, ___, ___, ___`
> string at the top of the program that extends all the way to the next
> computer.
One thing I somehow only realized recently: this is valid
```
from scipy.linalg import (
___,
___,
___,
___,
___,
___
)
```
which can help with readability / line lengths in situations like that.
--0000000000001a63bb05dad5032e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quot=
e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)=
;padding-left:1ex">Thank you David, I don't think referencing PEP8 is p=
edantic at all and I appreciate the response. </blockquote><div>=C2=A0</div=
><div>=F0=9F=91=8D<br clear=3D"all"><div><div dir=3D"ltr" class=3D"gmail_si=
gnature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div>=
<div dir=3D"ltr"><div><div dir=3D"ltr"><div><br></div></div></div></div></d=
iv></div></div></div></div></div></div></div></div><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex">As you say, in some sense it is just a regular Py=
thon style question and usually the best answer is just to do `import modul=
e`. Perhaps it is also best to just do that with scipy as well, or else you=
end up with this ridiculously long `from scipy.linalg import ___, ___, ___=
, ___, ___, ___` string at the top of the program that extends all the way =
to the next computer. </blockquote><div><br></div><div>One thing I somehow =
only realized recently: this is valid</div><div>```</div><div> <span style=
=3D"font-family:monospace">from scipy.linalg import (</span></div><div><spa=
n style=3D"font-family:monospace">=C2=A0=C2=A0=C2=A0 ___,</span></div><div>=
<span style=3D"font-family:monospace">=C2=A0=C2=A0=C2=A0 ___,</span></div><=
div><span style=3D"font-family:monospace">=C2=A0=C2=A0=C2=A0 ___,</span></d=
iv><div><span style=3D"font-family:monospace">=C2=A0=C2=A0=C2=A0 ___,</span=
></div><div><span style=3D"font-family:monospace">=C2=A0=C2=A0=C2=A0 ___,</=
span></div><div><span style=3D"font-family:monospace">=C2=A0=C2=A0=C2=A0 __=
_</span></div><div><span style=3D"font-family:monospace">)<br></span> </div=
><div><span style=3D"font-family:monospace">```</span><br></div><div>which =
can help with readability / line lengths in situations like that.</div><div=
>=C2=A0</div></div></div>
--0000000000001a63bb05dad5032e--
--===============9091779820416647762==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
SciPy-User mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/scipy-user.python.org/
Member address: [email protected]
--===============9091779820416647762==--