> "Lawrence D'Oliveiro" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>>
>> Why not just build a new list? E.g.
>>
>>newdevs = []
>>for dev in devs :
>>...
>>if not removing_dev :
>>newdevs.append(dev)
>>#end if
>>#end for
>>devs =
"Lawrence D'Oliveiro" <[EMAIL PROTECTED]> wrote in
message
news:[EMAIL PROTECTED]
Why not just build a new list? E.g.
newdevs = []
for dev in devs :
...
if not removing_dev :
newdevs.append(dev)
#end if
#end for
devs = newdevs
En Sun, 09 Sep 2007 22:58
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
> On Mon, 10 Sep 2007 17:42:16 +1000, bambam wrote:
>
>> "Lawrence D'Oliveiro" <[EMAIL PROTECTED]> wrote in
>> message news:[EMAIL PROTECTED]
>>> In message <[EMAIL PROTECTED]>, bambam wrote:
>>>
Thank you,
>>>
>>> Don't top-post.
>>
>> I h
On Mon, 10 Sep 2007 17:42:16 +1000, bambam wrote:
> "Lawrence D'Oliveiro" <[EMAIL PROTECTED]> wrote in
> message news:[EMAIL PROTECTED]
>> In message <[EMAIL PROTECTED]>, bambam wrote:
>>
>>> Thank you,
>>
>> Don't top-post.
>
> I have a number of news readers here, but all of them work
> better
A: Skid-marks in front of the hedgehog.
Q: What's the difference between a dead hedgehog on the road, and a dead
top-poster on the road?
--
http://mail.python.org/mailman/listinfo/python-list
On 9/10/07, bambam <[EMAIL PROTECTED]> wrote:
>
> I have a number of news readers here, but all of them work
> better with top-posting, and in none of them is top posting
> a problem. What software are you using?
>
> Steve.
>
I use gmail and I can assure you that top posting is annoying.
france
I have a number of news readers here, but all of them work
better with top-posting, and in none of them is top posting
a problem. What software are you using?
Steve.
"Lawrence D'Oliveiro" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> In message <[EMAIL PROTECTED]>, bambam wrot
bambam <[EMAIL PROTECTED]> wrote:
> > O(n) to find the element you wish to remove and move over
> > everything after it,
>
> Is that how lists are stored in cPython? It seems unlikely?
So-called "lists" in Python are stored contiguously in memory (more like
"vectors" in some other languages), so
In message <[EMAIL PROTECTED]>, bambam wrote:
> Thank you,
Don't top-post.
--
http://mail.python.org/mailman/listinfo/python-list
I can try that, but I'm not sure that it will work. The problem
is that devList is just a pointer to a list owned by someone else.
Making devList point to a new list won't work: I need to make
the parent list different. I could do this by adding an extra
level of indirection, but I think at the ris
I'm testing a series of scripts.
The scripts are testing a series of hardware devices.
The scripts are a sequence of device commands.
The scripts have sequence numbers.
I am adding exception handling to the to the 'inner
platform' that executes sequences.
I am doing this because testing of error
> Removing from a list while you iterate will had quadratic performance
Anecdote:
I was doing a route-finding program for a railway
ticketing system. My replacement explained to my boss
that it couldn't be done: the problem was one of that
class of problems that has no good optimum solution.
M
On Sep 6, 1:56 pm, Karthik Gurusamy <[EMAIL PROTECTED]> wrote:
> That said, it may be a good future language enhancement to define a
> reasonable consistent behavior for an iterator over a changing
> collection. This occurs quite common when we walk a collection and
> usually delete the current ite
On Sep 6, 7:44 am, "bambam" <[EMAIL PROTECTED]> wrote:
> First, thank you.
>
> All of the suggestions match what we want to do much better
> than what we are doing. We have a script, written in python,
> which is doing testing. But the python script doesn't look anything
> like the test script, bec
In message <[EMAIL PROTECTED]>, bambam wrote:
> The devices are in a list, and are removed by using pop(i). This
> messes up the loop iteration, so it is actually done by setting a
> flag on each device in the exception handler, with ANOTHER
> loop after each write/read/calculate sequence.
Why no
On Fri, 07 Sep 2007 12:03:26 +1000, bambam wrote:
> Hi Steven.
>
> Looking at your code, why are you naming the value __all__? It looks
> like a built-in variable?
When you say:
from module import *
Python looks in the module for a list of names called "__all__", and
imports only the names in
Hi Steven.
Looking at your code, why are you naming the value
__all__? It looks like a built-in variable?
Unless there is an automatic way to correctly get the
function list, I will probably be better off giving the lines
sequence numbers, and generating the function list from
that.
Steve.
"Ste
On Sep 5, 1:37 pm, James Stroud <[EMAIL PROTECTED]> wrote:
> Karthik Gurusamy wrote:
> > On Sep 5, 11:17 am, James Stroud <[EMAIL PROTECTED]> wrote:
>
> >> for i in xrange(number_of_reads):
> >>for dev in devs:
> >> try:
> >>_reader = getattr(dev, 'read%d' % i)
> >>_reader(
On Thu, 06 Sep 2007 15:44:57 +1000, bambam wrote:
> First, thank you.
>
> All of the suggestions match what we want to do much better than what we
> are doing. We have a script, written in python, which is doing testing.
> But the python script doesn't look anything like the test script,
> becaus
On Thu, 06 Sep 2007 15:44:57 +1000, bambam wrote:
> def script(self)
> def a0010(): global self; self.power_on([self.dev]);
> def a0020(): global self; self.dev.addLog([self.name, ' started']);
> def a0030(): global self; self.resetMinuteReg([self.dev]);
> def a0040(): global self;
First, thank you.
All of the suggestions match what we want to do much better
than what we are doing. We have a script, written in python,
which is doing testing. But the python script doesn't look anything
like the test script, because the python script is written in python,
and the test script i
On 9/5/07, James Stroud <[EMAIL PROTECTED]> wrote:
>
>
> Another way is to make a copy of devs, if devs is short, which makes my
>
>
When I process something of that genre (e.g. files) I prefer not to lose
trace of what's happened by removing the "bad items". Instead I prefer to
flag or otherwise
Karthik Gurusamy wrote:
> On Sep 5, 11:17 am, James Stroud <[EMAIL PROTECTED]> wrote:
>>
>> for i in xrange(number_of_reads):
>>for dev in devs:
>> try:
>>_reader = getattr(dev, 'read%d' % i)
>>_reader()
>> except Exception, e:
>>print e
>>devs.remove(
On 9/5/07, Karthik Gurusamy <[EMAIL PROTECTED]> wrote:
>
> On Sep 5, 11:17 am, James Stroud <[EMAIL PROTECTED]> wrote:
> > bambam wrote:
> > > I have about 30 pages (10 * 3 pages each) of code like this
> > > (following). Can anyone suggest a more compact way to
> > > code the exception handling? I
On Sep 5, 11:17 am, James Stroud <[EMAIL PROTECTED]> wrote:
> bambam wrote:
> > I have about 30 pages (10 * 3 pages each) of code like this
> > (following). Can anyone suggest a more compact way to
> > code the exception handling? If there is an exception, I need
> > to continue the loop, and conti
bambam wrote:
> I have about 30 pages (10 * 3 pages each) of code like this
> (following). Can anyone suggest a more compact way to
> code the exception handling? If there is an exception, I need
> to continue the loop, and continue the list.
>
> Steve.
>
> ---
> f
bambam a écrit :
> I have about 30 pages (10 * 3 pages each) of code like this
> (following). Can anyone suggest a more compact way to
> code the exception handling? If there is an exception, I need
> to continue the loop, and continue the list.
>
> Steve.
>
> ---
Sorry, just seen a mistake in my code, however Diez beat me to what I
was actually thinking!
Wes
On 05/09/07, Wesley Brooks <[EMAIL PROTECTED]> wrote:
> Try adding all the functions into a list such as;
>
> funcList = [dev.read1, dev.read2, dev.read3]
>
> for func in funcList:
>for dev in dev
On 9/5/07, bambam <[EMAIL PROTECTED]> wrote:
>
> I have about 30 pages (10 * 3 pages each) of code like this
> (following). Can anyone suggest a more compact way to
> code the exception handling? If there is an exception, I need
> to continue the loop, and continue the list.
>
> Steve.
>
>
def process_devs(devs, fun):
for dev in devs:
try:
fun(dev)
except:
print exception
remove dev from devs
return devs
process_devs(devs, lambda d: d.read1())
process_devs(devs, lambda d: d.read2())
...
On 9/5/07, bambam <[EMAIL PROTECT
Try adding all the functions into a list such as;
funcList = [dev.read1, dev.read2, dev.read3]
for func in funcList:
for dev in devs:
try:
func()
except:
print exception
remove dev from devs
Wes.
On 05/09/07, bambam <[EMAIL PROTECTED]> wrote:
>
bambam wrote:
> I have about 30 pages (10 * 3 pages each) of code like this
> (following). Can anyone suggest a more compact way to
> code the exception handling? If there is an exception, I need
> to continue the loop, and continue the list.
>
> Steve.
>
> ---
>
I have about 30 pages (10 * 3 pages each) of code like this
(following). Can anyone suggest a more compact way to
code the exception handling? If there is an exception, I need
to continue the loop, and continue the list.
Steve.
---
for dev in devs
try:
33 matches
Mail list logo