Thank you for the advice everyone.
>
> The first thing to try is find every place where you update myMax, and
This was actually where I was going wrong. I was setting max but then
overwriting it with item. Then kept checking item only to return myMax.
I went looking for other solutions as I th
Arup Rakshit wrote:
What protocols I need to
learn, to define a custom immutable class ?
That depends on how strictly you want to enforce immutability.
The easiest thing is not to enforce it at all and simply refrain
from mutating it. This is very often done.
You can provide some protection a
On Thu, Apr 18, 2019 at 5:41 PM Sayth Renshaw wrote:
>
> Thank you for the advice everyone.
>
> >
> > The first thing to try is find every place where you update myMax, and
>
> This was actually where I was going wrong. I was setting max but then
> overwriting it with item. Then kept checking ite
On Thu, Apr 18, 2019 at 6:16 PM Gregory Ewing
wrote:
>
> Arup Rakshit wrote:
> > What protocols I need to
> > learn, to define a custom immutable class ?
>
> That depends on how strictly you want to enforce immutability.
>
> The easiest thing is not to enforce it at all and simply refrain
> from m
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 2019-04-18 08:39, Sayth Renshaw wrote:
Thank you for the advice everyone.
The first thing to try is find every place where you update myMax, and
This was actually where I was going wrong. I was setting max but then
overwriting it with item. Then kept checking item only to return myMax.
On Wed, 17 Apr 2019, Sayth Renshaw wrote:
Apologies I don't know the answer but went looking. This guide should
answer the question. Didn't know it was so difficult to be honest.
https://chrisyeh96.github.io/2017/08/08/definitive-guide-python-imports.html#example-directory-structure
Then there
On Thu, 18 Apr 2019, dieter wrote:
Python knows about 2 kinds of "regular" imports: absolute ones and
relative ones. "Absolute" imports are guided by "sys.path" -- in the
simple case, a sequence of folders containing modules and/or pacakges.
Relative imports are guided in a similar way by the cu
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 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 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
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 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
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 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:
> 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 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
> >
--
https://mail.python.org/mailman/listinfo/python-list
> >
> It's still overly complicated.
>
This is where I have ended up. Without itertools and max its what I got
currently.
def maximum(listarg):
myMax = listarg[0]
for item in listarg:
for i in listarg[listarg.index(item)+1:len(listarg)]:
if myMax < i:
On 4/18/19 4:35 PM, Sayth Renshaw wrote:
It's still overly complicated.
This is where I have ended up. Without itertools and max its what I got
currently.
def maximum(listarg):
myMax = listarg[0]
for item in listarg:
for i in listarg[listarg.index(item)+1:len(li
On 2019-04-18, Rob Gaddi wrote:
> On 4/18/19 4:35 PM, Sayth Renshaw wrote:
>
>> This is where I have ended up. Without itertools and max its what I got
>> currently.
>>
>> def maximum(listarg):
>> myMax = listarg[0]
>> for item in listarg:
>> for i in listarg[listarg.index(ite
>
> In English rather than Python, how do you find the maximum element in a
> list?
>
> --
> Rob Gaddi, Highland Technology
Get first 1 item in the list and compare it to the rest. If it is larger than
rest its the max. However if another list member is larger it replaces the
first item a
On 19/04/19 5:22 PM, Sayth Renshaw wrote:
In English rather than Python, how do you find the maximum element in a
list?
--
Rob Gaddi, Highland Technology
Get first 1 item in the list and compare it to the rest. If it is larger than
rest its the max. However if another list member is larger
23 matches
Mail list logo