Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread Chris Angelico
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

Re: Importing module from another subdirectory

2019-04-17 Thread dieter
Rich Shepard writes: > What is the proper syntax to import the model class in the model/ > subdirectory into a tkinter view module, e.g., activities.py? The syntax, > 'import model as m' fails because it is not in the same subdirectory as the > importing module. > > The program directory tree is:

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread Cameron Simpson
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?

Re: Function to determine list max without itertools

2019-04-17 Thread DL Neil
On 18/04/19 4:10 PM, Sayth Renshaw wrote: I have created a function that takes a list as an argument. Without using itertools I want to compare each item in the list to find the max. However instead of the max I keep getting the last item in the list. Where is my logic wrong here? ... Seems

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
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?

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
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

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
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

Re: Function to determine list max without itertools

2019-04-17 Thread Sayth Renshaw
wrote: > > > > > > I have created a function that takes a list as an argument. > > Without using itertools I want to compare each item in the list to find the > > max. > > > > However instead of the max I keep getting the last item in the list. Where > > is my logic wrong here? > > > > def maxim

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
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,

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
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

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread Cameron Simpson
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

Re: Importing module from another subdirectory

2019-04-17 Thread Sayth Renshaw
On Thursday, 18 April 2019 06:59:43 UTC+10, Rich Shepard wrote: > What is the proper syntax to import the model class in the model/ > subdirectory into a tkinter view module, e.g., activities.py? The syntax, > 'import model as m' fails because it is not in the same subdirectory as the > importing

Re: Function to determine list max without itertools

2019-04-17 Thread Chris Angelico
On Thu, Apr 18, 2019 at 9:31 AM Sayth Renshaw wrote: > > > I have created a function that takes a list as an argument. > Without using itertools I want to compare each item in the list to find the > max. > > However instead of the max I keep getting the last item in the list. Where > is my logi

Function to determine list max without itertools

2019-04-17 Thread Sayth Renshaw
I have created a function that takes a list as an argument. Without using itertools I want to compare each item in the list to find the max. However instead of the max I keep getting the last item in the list. Where is my logic wrong here? def maximum(listarg): items = list(listarg) m

Importing module from another subdirectory

2019-04-17 Thread Rich Shepard
What is the proper syntax to import the model class in the model/ subdirectory into a tkinter view module, e.g., activities.py? The syntax, 'import model as m' fails because it is not in the same subdirectory as the importing module. The program directory tree is: bustrac/ README.rst bustr

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread Larry Martell
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

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread MRAB
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

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread Grant Edwards
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

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread Chris Angelico
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

Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
(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 'clean' every data field towards i

Re: doctest random output?

2019-04-17 Thread duncan smith
On 28/08/2017 20:17, Leam Hall wrote: > On 08/28/2017 11:40 AM, Dennis Lee Bieber wrote: > > ... a bunch of good stuff ... > > I'm (re-)learning python and just trying make sure my function works. > Not at the statistical or cryptographic level.   :) > > Thanks! > > Leam If it's supposed to ge

Re: immutability is not strictly the same as having an unchangeable value, it is more subtle

2019-04-17 Thread Arup Rakshit
Hi All, Thanks for explaining it so nice way. I got it now. What protocols I need to learn, to define a custom immutable class ? Thanks, Arup Rakshit a...@zeit.io > On 16-Apr-2019, at 10:54 PM, Dennis Lee Bieber wrote: > > On Tue, 16 Apr 2019 13:13:18 +0530, Arup Rakshit declaimed the >

Custom Python web development companies across the globe - ETG - Etisbew Technology Group

2019-04-17 Thread ETG GlobalServices
ETG one among the best custom Python web development companies across the globe, we cover a wide array of Python web app development services using latest framework like Django, CherryPy, Zope etc. https://bit.ly/2Maf8Hx  #pythonwebdevelopmentcompany#djangowebdevelopmentcompany -- https://mail.p