On Fri, Apr 19, 2019 at 3:27 AM Akkana Peck wrote:
>
> Chris Angelico writes:
> > Actually, only the Python interpreter has to be able to do those
> > steps. That's why I put the comment *on the same line* as the import
> > statement (not immediately above it, for instance). It comes out like
> >
Chris Angelico writes:
> Actually, only the Python interpreter has to be able to do those
> steps. That's why I put the comment *on the same line* as the import
> statement (not immediately above it, for instance). It comes out like
> this:
>
> (env) rosuav@sikorsky:~/shed$ python3 BL2_find_items.
On Fri, Apr 19, 2019 at 2:46 AM Akkana Peck wrote:
>
> Chris Angelico writes:
> > I write this as:
> >
> > import whois # ImportError? pip install python-whois
> [ ... ]
> > it means that normal exception handling is still
> > happening (which might be important if I import this into something
> >
Chris Angelico writes:
> I write this as:
>
> import whois # ImportError? pip install python-whois
[ ... ]
> it means that normal exception handling is still
> happening (which might be important if I import this into something
> else), plus it's printing the message to stderr rather than stdout
[
On 18/04/2019 17:10, Manolo MartÃnez wrote:
On 2019-04-17, DL Neil wrote:
2. When the program can still do something useful (if perhaps
feature-limited) without the imported module by substituting
something else in its place.
Isn't this a very common scenario, similar to what
On 2019-04-17, DL Neil wrote:
> 2. When the program can still do something useful (if perhaps
> feature-limited) without the imported module by substituting
> something else in its place.
Isn't this a very common scenario, similar to what package management systems
call "optional de
On Fri, Apr 19, 2019 at 1:36 AM Akkana Peck wrote:
> One example: there are a gazillion whois modules, and when I run my
> domaincheck program on a machine where I haven't yet installed
> whois, it's helpful to have a reminder of which one I should
> install. (Of course, if you have one of the oth
DL Neil writes:
> On 18/04/19 8:44 AM, Grant Edwards wrote:
> > 2. When the program can still do something useful (if perhaps
> > feature-limited) without the imported module by substituting
> > something else in its place.
>
> Any (publishable) examples?
One of the targets my RSS fet
On 2019-04-18, DL Neil wrote:
> On 18/04/19 8:44 AM, Grant Edwards wrote:
>> On 2019-04-17, DL Neil wrote:
>>
>>> Do you bother with exception handling for import statements?
>>
>> Sometimes. There are two cases when I do that:
>>
>> 1. When the module has different names under Python2 and
DL Neil wrote:
Thus the basic question: why do we (apparently) so seldom consider the
possibility of an ImportError?
Because the cases in which we can do something useful about
it are relatively rare.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Apr 18, 2019 at 2:32 PM DL Neil wrote:
>
> On 18/04/19 8:29 AM, Chris Angelico wrote:
> > On Thu, Apr 18, 2019 at 6:21 AM DL Neil
> > wrote:
> >> Do you bother with exception handling for import statements?
> >> Can we assume that if such a catastrophic error occurs, it is quite
> >> acc
On 18Apr2019 16:05, DL Neil wrote:
On 18/04/19 8:45 AM, MRAB wrote:
On 2019-04-17 21:20, DL Neil wrote:
Do you bother with exception handling for import statements?
Can we assume that if such a catastrophic error occurs, it is quite
acceptable for the code to fall-over in a tumbling-fumble?
On 18/04/19 1:24 PM, Cameron Simpson wrote:
On 17Apr2019 21:45, MRAB wrote:
On 2019-04-17 21:20, DL Neil wrote:
Do you bother with exception handling for import statements?
[...]
Catch only what you (well, the script) can fix.
If it needs numpy, but can't import numpy, then when can it do?
On 18/04/19 8:29 AM, Chris Angelico wrote:
On Thu, Apr 18, 2019 at 6:21 AM DL Neil wrote:
Do you bother with exception handling for import statements?
Can we assume that if such a catastrophic error occurs, it is quite
acceptable for the code to fall-over in a tumbling-fumble?
I try/except ar
On 18/04/19 8:44 AM, Grant Edwards wrote:
On 2019-04-17, DL Neil wrote:
Do you bother with exception handling for import statements?
Sometimes. There are two cases when I do that:
1. When the module has different names under Python2 and Python3 and
the program tries first one, then
On 18/04/19 8:45 AM, MRAB wrote:
On 2019-04-17 21:20, DL Neil wrote:
Do you bother with exception handling for import statements?
Can we assume that if such a catastrophic error occurs, it is quite
acceptable for the code to fall-over in a tumbling-fumble?
[snip]
Catch only what you (well,
On 18/04/19 8:53 AM, Larry Martell wrote:
On 2019-04-17 21:20, DL Neil wrote:
Do you bother with exception handling for import statements?
I often have to do something like this:
try:
from settings import SITE_WAFER_DIAMETER
except ImportError:
SITE_WAFER_DIAMETER = 300
That's an
On 17Apr2019 21:45, MRAB wrote:
On 2019-04-17 21:20, DL Neil wrote:
Do you bother with exception handling for import statements?
[...]
Catch only what you (well, the script) can fix.
If it needs numpy, but can't import numpy, then when can it do? Might
as well just let it fail.
I'm of thi
On 2019-04-17 21:20, DL Neil wrote:
> Do you bother with exception handling for import statements?
I often have to do something like this:
try:
from settings import SITE_WAFER_DIAMETER
except ImportError:
SITE_WAFER_DIAMETER = 300
--
https://mail.python.org/mailman/listinfo/python-list
On 2019-04-17 21:20, DL Neil wrote:
(I know it's not Friday [exp], and after personal apologies[apo])
Do you bother with exception handling for import statements?
Most of the code I read, both in books and during code review, eschews
any form of ImportError check. Even data science people who
On 2019-04-17, DL Neil wrote:
> Do you bother with exception handling for import statements?
Sometimes. There are two cases when I do that:
1. When the module has different names under Python2 and Python3 and
the program tries first one, then the other.
2. When the program can still do
On Thu, Apr 18, 2019 at 6:21 AM DL Neil wrote:
>
> (I know it's not Friday [exp], and after personal apologies[apo])
>
>
> Do you bother with exception handling for import statements?
>
>
> Most of the code I read, both in books and during code review, eschews
> any form of ImportError check. Even
22 matches
Mail list logo