Thank you for the hint !
On Fri, Oct 04, 2024 at 09:17:19AM GMT, Cameron Simpson wrote:
On 03Oct2024 22:12, Dan Ciprus (dciprus) wrote:
I'd be interested too :-).
Untested sketch:
def make_thread(target, *a, E=None, **kw):
'''
Make a new Event E and Thread T, pass `[E,*a]`
On 03Oct2024 22:12, Dan Ciprus (dciprus) wrote:
I'd be interested too :-).
Untested sketch:
def make_thread(target, *a, E=None, **kw):
'''
Make a new Event E and Thread T, pass `[E,*a]` as the target
positional arguments.
A shared preexisting Event may be
I'd be interested too :-).
On Thu, Sep 26, 2024 at 03:34:05AM GMT, marc nicole via Python-list wrote:
Could you show a python code example of this?
On Thu, 26 Sept 2024, 03:08 Cameron Simpson, wrote:
On 25Sep2024 22:56, marc nicole wrote:
>How to create a per-thread event in Python 2.7?
E
That's one of the "disadvantages" of threads: you cannot safely stop a
thread. Of course you could try, but that's never a good idea. The
reason for this is that threads share memory. They might be holding
locks that, if killed, will never be unlocked. They might (partiall
Could you show a python code example of this?
On Thu, 26 Sept 2024, 03:08 Cameron Simpson, wrote:
> On 25Sep2024 22:56, marc nicole wrote:
> >How to create a per-thread event in Python 2.7?
>
> Every time you make a Thread, make an Event. Pass it to the thread
> worker function and keep it to
On 25Sep2024 22:56, marc nicole wrote:
How to create a per-thread event in Python 2.7?
Every time you make a Thread, make an Event. Pass it to the thread
worker function and keep it to hand for your use outside the thread.
--
https://mail.python.org/mailman/listinfo/python-list
How to create a per-thread event in Python 2.7?
On Wed, 25 Sept 2024, 22:47 Cameron Simpson via Python-list, <
python-list@python.org> wrote:
> On 25Sep2024 19:24, marc nicole wrote:
> >I want to know how to kill a specific running thread (say by its id)
> >
> >for now I run and kill a thread li
On 25Sep2024 19:24, marc nicole wrote:
I want to know how to kill a specific running thread (say by its id)
for now I run and kill a thread like the following:
# start thread
thread1 = threading.Thread(target= self.some_func(), args=( ...,), )
thread1.start()
# kill the thread
event_thread1 = t
Hello guys,
I want to know how to kill a specific running thread (say by its id)
for now I run and kill a thread like the following:
# start thread
thread1 = threading.Thread(target= self.some_func(), args=( ...,), )
thread1.start()
# kill the thread
event_thread1 = threading.Event()
event_thread
rated.
And I mean especially in this case where we have no idea what "he" was
writing but it was a private message not intended for the group.
Just kidding BTW. But since YOU are Michael Torrie, I guess you can
broadcast a request to stop mailing yourself if that pleases. I will just no
lo
On 2/27/23 09:17, Grant Edwards wrote:
> On 2023-02-27, Michael Torrie wrote:
>
>> I've been putting off sending this message for days, but the list noise
>> level is now to the point that it has to be said.
>
> Ah, I've finially realized why some of those threads have seemed so
> disjointed to
On 2023-02-27, Michael Torrie wrote:
> I've been putting off sending this message for days, but the list noise
> level is now to the point that it has to be said.
Ah, I've finially realized why some of those threads have seemed so
disjointed to me. Years ago, I plonked all posts which are (like
n Python into LISP! :)
Do you understand why your posts have been causing frustration? This is
an existing community that you've chosen to join. Many of the people
you've insulted here, including dn have been participating and helpfully
contributing to this list for many years.
Please s
On Sun, Feb 26, 2023 at 3:49 PM Hen Hanna wrote:
>
> Rob Cliffe should stop sending me rude email messages.
You should stop spamming this lists with with meaningless posts.
--
https://mail.python.org/mailman/listinfo/python-list
didn't get
through, apparently)
were among the few that were relevant.
On Sunday, February 26, 2023 at 10:10:09 AM UTC-8, Hen Hanna wrote:
> Rob Cliffe should stop sending me rude email messages.
>
>
> At the very least, Rob Cliffe should s
Rob Cliffe should stop sending me rude email messages.
At the very least, Rob Cliffe should stop sending me ANY email messages, if
he doesn't intend to an email i've sent him.
--
https://mail.python.org/mailman/listinfo/python-list
On Saturday, 30 October 2021, Dieter Maurer wrote:
> Shaozhong SHI wrote at 2021-10-29 23:42 +0100:
> >Python script works well, but seems to stop running at a certain point
> when
> >handling very large dataset.
> >
> >Can anyone shed light on this?
>
> Som
Shaozhong SHI wrote at 2021-10-29 23:42 +0100:
>Python script works well, but seems to stop running at a certain point when
>handling very large dataset.
>
>Can anyone shed light on this?
Some algorithms have non linear runtime.
For example, it is quite easy to write code with
quadr
On 2021-10-29, Shaozhong SHI wrote:
> Python script works well, but seems to stop running at a certain point when
> handling very large dataset.
>
> Can anyone shed light on this?
No.
Nobody can help you with the amount of information you have provided.
--
Grant
--
https://mai
) to see how much memory
is consumed?
On Fri, 2021-10-29 at 23:42 +0100, Shaozhong SHI wrote:
> Python script works well, but seems to stop running at a certain
> point when
> handling very large dataset.
>
> Can anyone shed light on this?
>
> Regards, David
--
https://ma
On Fri, Oct 29, 2021 at 4:04 PM dn via Python-list
wrote:
> On 30/10/2021 11.42, Shaozhong SHI wrote:
> > Python script works well, but seems to stop running at a certain point
> when
> > handling very large dataset.
> >
> > Can anyone shed light on this?
>
>
On 30/10/2021 11.42, Shaozhong SHI wrote:
> Python script works well, but seems to stop running at a certain point when
> handling very large dataset.
>
> Can anyone shed light on this?
Storage space?
Taking time to load/format/process data-set?
--
Regards,
=dn
--
https://mai
Python script works well, but seems to stop running at a certain point when
handling very large dataset.
Can anyone shed light on this?
Regards, David
--
https://mail.python.org/mailman/listinfo/python-list
On 16Oct2020 22:07, Albert-Jan Roskam wrote:
> I was using datetime.now().isoformat('T', 'seconds')
> Not 100% sure, but the strings seemed to be 2hrs off. Could it be that
> this Linux server was using the wrong time zone?
Maybe. This is why timezones are such a nightmare, and programmes
I get datetime to stop showing seconds?
>
> On 2020-10-16 9:42 AM, Steve wrote:
>> d2 = datetime.datetime.now() #Time Right now
>>
I was using datetime.now().isoformat('T', 'seconds')
Not 100% sure, but the strings seemed to be 2
Steve wrote:
> d2 = datetime.datetime.now() #Time Right now
>
> Show this: 2020-10-16 02:53
> and not this: 2020-10-16 02:53:48.585865
>
>
> ==
> Footnote:
> If you double major in psychology and reverse psychology, to they cancel
> e
On 10/16/20, Steve wrote:
> -Original Message-
> From: Python-list On
> Behalf Of Frank Millman
> Sent: Friday, October 16, 2020 4:34 AM
> To: python-list@python.org
> Subject: Re: How do I get datetime to stop showing seconds?
>
> On 2020-10-16 9:4
Right on target,
Many Thanks
FootNote:
If money does not grow on trees, then why do banks have branches?
-Original Message-
From: Python-list On
Behalf Of Frank Millman
Sent: Friday, October 16, 2020 4:34 AM
To: python-list@python.org
Subject: Re: How do I get datetime to stop
Another way is:
'{:%Y-%m-%d %H:%M}'.format(d2)
--
https://mail.python.org/mailman/listinfo/python-list
On 2020-10-16 9:42 AM, Steve wrote:
d2 = datetime.datetime.now() #Time Right now
Show this: 2020-10-16 02:53
and not this: 2020-10-16 02:53:48.585865
>>>
>>> str(d2)
'2020-10-16 10:29:38.423371'
>>>
>>> d2.strftime('%Y-%m-%d %H:%M')
'2020-10-16 10:29'
>>>
Frank Millman
--
https://mail.pyt
d2 = datetime.datetime.now() #Time Right now
Show this: 2020-10-16 02:53
and not this: 2020-10-16 02:53:48.585865
==
Footnote:
If you double major in psychology and reverse psychology, to they cancel
each other out?
--
--
https://m
9 12:55 AM, ferzan saglam wrote:
I have tried many ways to stop the infinite loop but my program doesn't seem to
stop after 10 items! It keeps going...!)
---
total = 0
while True:
print('Cost of item')
item = input()
if item != -1:
total += int(
ferzan saglam wrote:
> On Wednesday, October 30, 2019 at 2:19:32 PM UTC, Matheus Saraiva wrote:
>> rounds = 0
>> while rounds <= 10:
...
> Thanks, it Works superbly.
> To get the limit of 10 i wanted, i had to make a slight change:
> while rounds <= 9 .
That's the (in)famous "off by one"
> > total += int(item)
> > else:
> > break
> >
> > print(total)
> The program does not stop because its code does not contain any deals
> that make the loop stop after 10 rounds. You can simply implement a
> counter that counts the number of times the loo
> On Oct 30, 2019, at 4:55 AM, ferzan saglam wrote:
>
> I have tried many ways to stop the infinite loop but my program doesn't seem
> to stop after 10 items! It keeps going...!)
>
> ---
> total = 0
> item = input()
> if item != -1:
If you try this in the REPL, you'll see that 'item' is a string. You're
trying to compare it to an integer, which will always fail.
The cheapest way to fix this is probably:
if item != '-1':
Best,
G
--
https://
m 30/10/2019 08:55, ferzan saglam escreveu:
total = 0
while True:
print('Cost of item')
item = input()
if item != -1:
total += int(item)
else:
break
print(total)
The program does not stop because its code does not contain any deals
that make the loop sto
you compare against an integer ->
item != -1
This total += int(item) should be raised by one as you don't know what
item actually is, it might be a text
Eren
Am Mi., 30. Okt. 2019 um 13:01 Uhr schrieb ferzan saglam <
ferzan...@gmail.com>:
> I have tried many ways to stop the
I have tried many ways to stop the infinite loop but my program doesn't seem to
stop after 10 items! It keeps going...!)
---
total = 0
while True:
print('Co
stuff in a database.
> >> I have a cron job to call 'stop' and 'start' on it daily, just in case
> >> of problems.
> >>
> >> Occasionally the oom-killer runs overnight and kills the process using
> >> bottledaemon; when this happens (
On 2018-11-19, Dennis Lee Bieber wrote:
> On Sun, 18 Nov 2018 15:33:47 -0600, Dan Sommers
><2qdxy4rzwzuui...@potatochowder.com> declaimed the following:
>
>>
>>What if the oom-killer kills the watchdog?
>>
>
> Then you have TWO processes with out-of-control memory growth.
>
> The out-o
On 11/18/18 1:21 PM, MRAB wrote:> On 2018-11-18 17:50, Adam Funk wrote:
>> Hi,
>>
>> I'm using bottledaemon to run a little REST service on a Pi that takes
>> input from other machines on the LAN and stores stuff in a database.
>> I have a cron job to call &
On 2018-11-18 17:50, Adam Funk wrote:
Hi,
I'm using bottledaemon to run a little REST service on a Pi that takes
input from other machines on the LAN and stores stuff in a database.
I have a cron job to call 'stop' and 'start' on it daily, just in case
of problems.
Oc
Hi,
I'm using bottledaemon to run a little REST service on a Pi that takes
input from other machines on the LAN and stores stuff in a database.
I have a cron job to call 'stop' and 'start' on it daily, just in case
of problems.
Occasionally the oom-killer runs overni
On 16Jul2018 08:33, Thomas Jollans wrote:
On 16/07/18 08:24, Gerlando Falauto wrote:
On Monday, July 16, 2018 at 8:13:46 AM UTC+2, Thomas Jollans wrote:
On 16/07/18 07:39, Gerlando Falauto wrote:
On Monday, July 16, 2018 at 6:56:19 AM UTC+2, dieter wrote:
...
Why is the main thread taking up
On 16/07/18 08:24, Gerlando Falauto wrote:
> On Monday, July 16, 2018 at 8:13:46 AM UTC+2, Thomas Jollans wrote:
>> On 16/07/18 07:39, Gerlando Falauto wrote:
>>> On Monday, July 16, 2018 at 6:56:19 AM UTC+2, dieter wrote:
> ...
> Why is the main thread taking up so much CPU?
> I believ
On Monday, July 16, 2018 at 8:13:46 AM UTC+2, Thomas Jollans wrote:
> On 16/07/18 07:39, Gerlando Falauto wrote:
> > On Monday, July 16, 2018 at 6:56:19 AM UTC+2, dieter wrote:
> >>> ...
> >>> Why is the main thread taking up so much CPU?
> >>> I believe at this point listener.stop() should only be
On 16/07/18 07:39, Gerlando Falauto wrote:
> On Monday, July 16, 2018 at 6:56:19 AM UTC+2, dieter wrote:
>>> ...
>>> Why is the main thread taking up so much CPU?
>>> I believe at this point listener.stop() should only be waiting for the
>>> helper thread to terminate, which I reckon would be impl
On Monday, July 16, 2018 at 6:56:19 AM UTC+2, dieter wrote:
> > ...
> > Why is the main thread taking up so much CPU?
> > I believe at this point listener.stop() should only be waiting for the
> > helper thread to terminate, which I reckon would be implemented by waiting
> > on a semaphore or som
Gerlando Falauto writes:
> ...
> Why is the main thread taking up so much CPU?
> I believe at this point listener.stop() should only be waiting for the helper
> thread to terminate, which I reckon would be implemented by waiting on a
> semaphore or something (i.e. iowait i.e. 0% CPU).
Maybe, yo
Hi,
I'm adding logging to a time critical task running resource-constrained
hardware (Raspberry Pi).
I read about the QueueListener/QueueHandler in:
https://docs.python.org/3/howto/logging-cookbook.html#dealing-with-handlers-that-block
and I'm trying to understand how it really works and what's
I am excecting custom commands like shell on multiple linux hosts. and if in
one host one of the commands fail. I want that process not to proceed. If the
remote command throws an error i am logging it .. but the process goes to next
command . but if i terminate the command, the process will t
On Monday, January 1, 2018 at 11:06:30 PM UTC, P. timoriensis wrote:
> >> stop prohibition of comp.lang.python !
> >>
> >> it is childish to do this prohibition business !
> >>
> >> don't you have spam filters ?
> >
> > The prohib
On Monday, January 1, 2018 at 3:00:19 PM UTC, S. I. wrote:
> stop prohibition of comp.lang.python !
>
> it is childish to do this prohibition business !
>
> don't you have spam filters ?
The prohibition part of the subject line is added by Lawrence D'Oliveiro when
he
On 2017-10-07 17:38, Prabu T.S. wrote:
I would like to continue to second function invocation
"checkServiceStatus('AdobeARMservice')" even if the first
checkServiceStatus('Tomcat9') has any exception.Please advice.Second
function invocation not getting executed if any exception occurs in
On 2017-10-07, Jorge Gimeno wrote:
> Catching all exceptions in a try-except block is almost always a bad
> idea.
Catching it and ignoring it as the OP was doing (or assuming it's some
particular exception) certainly is.
If you know (or suspect) that stderr isn't going anywhere that it will
be
Catching all exceptions in a try-except block is almost always a bad idea.
You can't tell the difference between an exception that you are looking to
handle and an exception that should cause your program to crash and burn
(because something is wrong). It's best to catch a specific exception.
What
On Saturday, October 7, 2017 at 12:38:11 PM UTC-4, Prabu T.S. wrote:
> I would like to continue to second function invocation
> "checkServiceStatus('AdobeARMservice')" even if the first
>checkServiceStatus('Tomcat9') has any exception.Please advice.Second
> function invocation not getting e
I would like to continue to second function invocation
"checkServiceStatus('AdobeARMservice')" even if the first
checkServiceStatus('Tomcat9') has any exception.Please advice.Second
function invocation not getting executed if any exception occurs in
first.Please advice.
import psutil
def
t 8:33:02 PM UTC-4, MRAB wrote:
> >> >> On 2017-10-05 23:32, Prabu T.S. wrote:
> >> >> > On Thursday, October 5, 2017 at 6:16:44 PM UTC-4, Prabu T.S. wrote:
> >> >> >> hello all,what is the command to stop and start windows servi
On Thu, 05 Oct 2017 17:37:11 -0700, Prabu T.S. wrote:
> On Thursday, October 5, 2017 at 8:33:02 PM UTC-4, MRAB wrote:
>> On 2017-10-05 23:32, Prabu T.S. wrote:
>> > On Thursday, October 5, 2017 at 6:16:44 PM UTC-4, Prabu T.S. wrote:
>> >> hello all,what is the com
>> >> > On Thursday, October 5, 2017 at 6:16:44 PM UTC-4, Prabu T.S. wrote:
>> >> >> hello all,what is the command to stop and start windows services ?
>> >> >> i can't install win32serviceutil bec am using latest python version.
>> >
:44 PM UTC-4, Prabu T.S. wrote:
> >> >> hello all,what is the command to stop and start windows services ?
> >> >> i can't install win32serviceutil bec am using latest python version.
> >> >
> >> > Please advice on this
> >> >
> >
On 2017-10-06 01:37, Prabu T.S. wrote:
On Thursday, October 5, 2017 at 8:33:02 PM UTC-4, MRAB wrote:
On 2017-10-05 23:32, Prabu T.S. wrote:
> On Thursday, October 5, 2017 at 6:16:44 PM UTC-4, Prabu T.S. wrote:
>> hello all,what is the command to stop and start windows services ?
&
On Thursday, October 5, 2017 at 8:33:02 PM UTC-4, MRAB wrote:
> On 2017-10-05 23:32, Prabu T.S. wrote:
> > On Thursday, October 5, 2017 at 6:16:44 PM UTC-4, Prabu T.S. wrote:
> >> hello all,what is the command to stop and start windows services ?
> >> i can't insta
On 2017-10-05 23:32, Prabu T.S. wrote:
On Thursday, October 5, 2017 at 6:16:44 PM UTC-4, Prabu T.S. wrote:
hello all,what is the command to stop and start windows services ?
i can't install win32serviceutil bec am using latest python version.
Please advice on this
Ask Google: wi
On Thursday, October 5, 2017 at 6:16:44 PM UTC-4, Prabu T.S. wrote:
> hello all,what is the command to stop and start windows services ?
> i can't install win32serviceutil bec am using latest python version.
Please advice on this
--
https://mail.python.org/mailman/listinfo/python-list
hello all,what is the command to stop and start windows services ?
i can't install win32serviceutil bec am using latest python version.
--
https://mail.python.org/mailman/listinfo/python-list
Can you show us some of the code you tried?
On Monday, June 26, 2017 at 10:19:46 AM UTC+3, Bhaskar Dhariyal wrote:
> Hi everyone!
>
> I have a dataset which I want to make model trainable. I ahve been trying to
> do some thing for past 2-3 days.
>
> Actually I wanted to clean 'desc' and 'keywo
Hi everyone!
I have a dataset which I want to make model trainable. I ahve been trying to do
some thing for past 2-3 days.
Actually I wanted to clean 'desc' and 'keywords' column from the dataset. I am
using NLTK to vectorize, than remove stopwords & alpha numeric values and do
stemming. More
remaining values, but the builtin min() will continue.
>>
>> The solution is a minimum function that allows the user to specify a stop
>> value:
>>
>> >>> from itertools import count, chain
>> >>> stopmin(chain(reversed(range(10)), count()), ke
inue.
>
> The solution is a minimum function that allows the user to specify a stop
> value:
>
> >>> from itertools import count, chain
> >>> stopmin(chain(reversed(range(10)), count()), key=abs, stop=0)
> 0
>
> How would you implement stopmin
Jussi Piitulainen writes:
> It could still be added as an option, to both takewhile and iter(_, _).
That's too messy, it really should be pervasive in iterators.
--
https://mail.python.org/mailman/listinfo/python-list
Peter Otten <__pete...@web.de> writes:
> return min(take_until(), key=firstitem)[1]
Actually, key=abs should work. I realized that after posting.
--
https://mail.python.org/mailman/listinfo/python-list
Paul Rubin writes:
> I think Python's version of iterators is actually buggy and at least
> the first element of the rest of the sequence should be preserved.
> There are ways to fake it but they're too messy for something like
> this. It should be the default and might have been a good change fo
Paul Rubin writes:
> Jussi Piitulainen writes:
>> That would return 0 even when there is no 0 in xs at all.
>
> Doesn't look that way to me:
>
> >>> minabs([5,3,1,2,4])
> 1
Sorry about that. I honestly meant to say it would return 1 even when
there was a single 0 at the very end. Somehow
min(z())[1]
>
> is the same thing but a little bit nicer.
Yes, that's another variant of the decorate/undecorate approach combined
with Wolfgang's local take_until(). The generalized form that cannot rely on
the sequence items being orderable would be
firstitem = operator.i
Paul Rubin writes:
> seems to work, but is ugly. Maybe there's something better.
def minabs2(xs):
def z():
for x in xs:
yield abs(x), x
if x==0: break
return min(z())[1]
is the same thing but a little bit nicer.
--
https://mail.py
Paul Rubin writes:
> Doesn't look that way to me:
> >>> minabs([5,3,1,2,4])
> 1
There's a different problem though:
>>> minabs([1,2,3,0])
1
I think Python's version of iterators is actually buggy and at least the
first element of the rest of the sequence should be preserved. Th
Jussi Piitulainen writes:
> That would return 0 even when there is no 0 in xs at all.
Doesn't look that way to me:
>>> minabs([5,3,1,2,4])
1
--
https://mail.python.org/mailman/listinfo/python-list
Pablo Lucena writes:
> How about using the second usage of builtin iter()?
>
> In [92]: iter?
> Docstring:
> iter(iterable) -> iterator
> iter(callable, sentinel) -> iterator
Nice to learn about that. But it has the same problem as
itertools.takewhile:
> In [88]: numbers
> Out[88]: [1, 9, 8, 11,
Paul Rubin writes:
> Jussi Piitulainen writes:
>>> Use itertools.takewhile
>> How? It consumes the crucial stop element:
>
> Oh yucch, you're right, it takes it from both sides. How about this:
>
> from itertools import takewhile, islice
> def mina
Jussi Piitulainen writes:
>> Use itertools.takewhile
> How? It consumes the crucial stop element:
Oh yucch, you're right, it takes it from both sides. How about this:
from itertools import takewhile, islice
def minabs(xs):
a = iter(xs)
m = min(map(abs,take
How about using the second usage of builtin iter()?
In [92]: iter?
Docstring:
iter(iterable) -> iterator
iter(callable, sentinel) -> iterator
Get an iterator from an object. In the first form, the argument must
supply its own iterator, or be a sequence.
*In the second form, the callable is calle
Rustom Mody writes:
> On a Saturday, Jussi Piitulainen wrote:
[snip]
>> You switched to a simpler operator. Would Haskell notice that
>>
>>def minabs(x, y): return min(x, y, key = abs)
>>
>> has a meaningful zero? Surely it has its limits somewhere and then
>> the programmer needs to supply
n()?
> >> >
> >> > Use itertools.takewhile
> >>
> >> How? It consumes the crucial stop element:
> >>
> >>it = iter('what?')
> >>list(takewhile(str.isalpha, it)) # ==> ['w', 'h', 'a
tion that allows the user to specify a stop
> value:
Thanks everyone who contributed to this thread!
For those interested here's my collection of stopmin() implementations so
far. Remember, there should be one ... *obvious* way to do it (emphasis
mine).
$ cat stopmin_simple.py
ut the builtin min() will continue.
>>
>> The solution is a minimum function that allows the user to specify a stop
>> value:
>>
>>>>> from itertools import count, chain
>>>>> stopmin(chain(reversed(range(10)), count()), key=abs, stop=0)
>
Paul Rubin wrote:
> Peter Otten <__pete...@web.de> writes:
>> How would you implement stopmin()?
>
> Use itertools.takewhile
I should have mentioned that I had already run into that -- let's call it --
off-by-one bug.
--
https://mail.python.org/mailman/listinfo/python-list
) will continue.
>>
>> The solution is a minimum function that allows the user to specify a stop
>> value:
>>
>>>>> from itertools import count, chain
>>>>> stopmin(chain(reversed(range(10)), count()), key=abs, stop=0)
>> 0
>>
&g
inue.
>>
>> The solution is a minimum function that allows the user to specify a stop
>> value:
>>
>>>>> from itertools import count, chain
>>>>> stopmin(chain(reversed(range(10)), count()), key=abs, stop=0)
>> 0
>>
>> How w
On Sat, 7 Jan 2017 07:06 am, Wolfgang Maier wrote:
> On 1/6/2017 15:04, Peter Otten wrote:
[...]
>> How would you implement stopmin()?
>>
>
> How about:
>
> def stopmin (iterable, key, stop):
> def take_until ():
> for e in iterable:
>
Chris Angelico writes:
> On Sat, Jan 7, 2017 at 7:12 PM, Jussi Piitulainen wrote:
>> You switched to a simpler operator. Would Haskell notice that
>>
>>def minabs(x, y): return min(x, y, key = abs)
>>
>> has a meaningful zero? Surely it has its limits somewhere and then
>> the programmer need
On Sat, Jan 7, 2017 at 7:12 PM, Jussi Piitulainen
wrote:
> You switched to a simpler operator. Would Haskell notice that
>
>def minabs(x, y): return min(x, y, key = abs)
>
> has a meaningful zero? Surely it has its limits somewhere and then the
> programmer needs to supply the information.
If
Rustom Mody writes:
> On Saturday, Jussi Piitulainen wrote:
>> Paul Rubin writes:
>>
>> > Peter Otten writes:
>> >> How would you implement stopmin()?
>> >
>> > Use itertools.takewhile
>>
>> How? It consumes the crucial stop elem
t; The solution is a minimum function that allows the user to specify a stop
> value:
>
>>>> from itertools import count, chain
>>>> stopmin(chain(reversed(range(10)), count()), key=abs, stop=0)
> 0
>
> How would you implement stopmin()?
That depends on whether
On Saturday, January 7, 2017 at 12:26:04 PM UTC+5:30, Jussi Piitulainen wrote:
> Paul Rubin writes:
>
> > Peter Otten writes:
> >> How would you implement stopmin()?
> >
> > Use itertools.takewhile
>
> How? It consumes the crucial stop element:
>
&
Paul Rubin writes:
> Peter Otten writes:
>> How would you implement stopmin()?
>
> Use itertools.takewhile
How? It consumes the crucial stop element:
it = iter('what?')
list(takewhile(str.isalpha, it)) # ==> ['w', 'h', 'a', 't
Peter Otten <__pete...@web.de> writes:
> How would you implement stopmin()?
Use itertools.takewhile
--
https://mail.python.org/mailman/listinfo/python-list
that allows the user to specify a stop
value:
from itertools import count, chain
stopmin(chain(reversed(range(10)), count()), key=abs, stop=0)
0
How would you implement stopmin()?
How about:
def stopmin (iterable, key, stop):
def take_until ():
for e in iterable:
yi
1 - 100 of 596 matches
Mail list logo