Re: Multiple disjoint sample sets?

2013-01-13 Thread Peter Otten
Roy Smith wrote:

> I have a list of items.  I need to generate n samples of k unique items
> each.  I not only want each sample set to have no repeats, but I also
> want to make sure the sets are disjoint (i.e. no item repeated between
> sets).
> 
> random.sample(items, k) will satisfy the first constraint, but not the
> second.  Should I just do random.sample(items, k*n), and then split the
> resulting big list into n pieces?  Or is there some more efficient way?
> 
> Typical values:
> 
> len(items) = 5,000,000
> n = 10
> k = 100,000

I would expect that your simple approach is more efficient than shuffling 
the whole list. 

Assuming there is a sample_iter(population) that generates unique items from 
the population (which has no repetitions itself) you can create the samples 
with

g = sample_iter(items)
samples = [list(itertools.islice(g, k) for _ in xrange(n)]

My ideas for such a sample_iter():

def sample_iter_mark(items):
n = len(items)
while True:
i = int(random()*n)
v = items[i]
if v is not None:
yield v
items[i] = None

This is destructive and will degrade badly as the number of None items 
increases. For your typical values it seems to be OK though. You can make 
this non-destructive by adding a bit array or a set (random.Random.sample() 
has code that uses a set) to keep track of the seen items.

Another sample_iter() (which is also part of the random.Random.sample() 
implementation):

def sample_iter_replace(items):
n = len(items)
for k in xrange(n):
i = int(random()*(n-k))
yield items[i]
items[i] = items[n-k-1]

You can micro-optimise that a bit to avoid the index calculation. Also, 
instead of overwriting items you could swap them, so that no values would be 
lost, only their initial order.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problem with exam task for college

2013-01-13 Thread jeltedeproft_8
sorry for the extremely late reply, i have been very very busy :s

i implemented the solution that was posted in the second to last post. but now 
it gets a little confusing because i think a couple terms where deleted that i 
refered to in other code blocks, so once again i''l post the full code here



from visual import *
import time
import math
import random
from datetime import datetime
import operator 


class lunar_lander(object):
def __init__(self):
scene.title = 'mini star wars'
scene.width = 375
scene.height = 550
scene.center = (0,0)
self.pos = (0,0)
self.axis = 0
self.brandstofmeter = brandstofmeter()
self.ruimteschip = ruimteschip()
self.view = game_view(self)



def play(self):
t=0
dt=0.01
self.ruimteschip.updatemeter = False
while t<9:
time.sleep(0.01)
self.ruimteschip.update(dt)
t = t + dt
if self.ruimteschip.updatemeter == True:
self.brandstofmeter.update





class game_view(object):
def __init__(self,owner):
autoscale=True
box(pos=( 0, -375, 0), length=500, height=5, width=0, color = 
color.white)
box(pos=(0,375, 0), length=500, height=5, width=0, color = color.white)
box(pos=(-250,0, 0), length=5, height=750, width=0, color = color.white)
box(pos=(250,0, 0), length=5, height=750, width=0, color = color.white)

maan = 
curve(pos=[(-250,-353),(-240,-341),(-210,-354),(-199.5,-374)],color=color.red)
maana = curve(pos=[(-199.5,-374),(-166,-374)],color=color.green)
maanb = 
curve(pos=[(-166,-374),(-140,-357),(-80,-319),(-40,-361),(0,-321),(40,-329),(80,-347)],color=color.red)
maanc = curve(pos=[(80,-347),(140,-347)],color=color.green)
maand = 
curve(pos=[(140,-347),(162,-337),(189.5,-365),(210,-355),(240,-372),(250,-338)],color=color.red)

for i in random.sample(range (-250,250),20):
for j in random.sample(range (-375,375),20):
sterren = points(pos = [i,j,0],size = 2, color=color.white)




class brandstofmeter(object):
def __init__(self):
axis = 0
self.pos = (210,345)
self.length = 25
self.height = 45
self.meter = box(pos = self.pos, length = self.length, height = 
self.height,color = color.green)
def update(self):
self.height = self.height - 0.2
print "ok"




class ruimteschip(object):
def __init__(self):
self.pos = vector(0,330)
self.acceleration = vector(0,-88,0)
self.axis = (1,0,0)
self.hoek = (90*math.pi)/180
self.graden = math.degrees(self.hoek)
self.gas = vector(10 * cos(self.hoek),10 * sin (self.hoek))
self.velocity = vector(0,0,0)
self.angle = pi / 2
self.updatemeter = False
self.view = ruimteschip_view(self)
self.vlam = self.view.vlam
self.frame = self.view.frame
self.zicht = brandstofmeter()



def update(self,dt):
self.velocity = self.velocity + (self.acceleration * dt)
self.pos = self.pos + self.velocity * dt

if scene.kb.keys:
key = scene.kb.getkey()
if key == "left":
# Set left deviation
self.frame.axis -= (0, 0, 0.05)
self.gas = vector(-sin(self.angle), cos(self.angle))

elif key == "right":
# Set right deviation
self.frame.axis += (0, 0, 0.05)
self.gas = vector(sin(self.angle), cos(self.angle))

elif key == "up":
self.deviate()

def deviate(self):
# Set modified velocity
self.frame.velocity += self.gas
self.frame.pos += self.frame.velocity
# Reset falling velocity
self.frame.velocity -= self.gas


 
if self.pos.x > 250:
self.pos.x = -250
if self.pos.x < -250:
self.pos.x = 250
self.view.update(self)

class ruimteschip_view(object):
def __init__(self,owner):
self.owner = owner
self.frame = frame(pos = owner.pos,axis = owner.axis)
self.motor = curve(frame = 
self.frame,pos=[(0,24.0),(22.0,24.0),(22.0,39.0),(-22.0,39.0),(-22,24),(0,24)])
self.capsule = curve(frame = self.frame,color = color.blue 
,pos=[(0,39),(-3,39),(-9,44),(-12,46),(-18,48),(-22,50),(-18,52),(-12,54),(-9,56),(-3,61),(0,61),(3,59),(9,56),(12,54),(18,52),(22,50),(18,48),(12,46),(9,44),(3,39),(0,39)])
self.poota = curve(frame = self.frame,pos = 
[(-18,24),(-20,24),(-20,0),(-18,0),(-18,24)])
self.pootb = curve(frame = self.frame,pos = 
[(18,24),(20,24),(20,0),(18,0),(18,24)])
self.vlam = curve(frame =

For Loop in List

2013-01-13 Thread subhabangalore
Dear Group,

I have a list like,

>>> list1=[1,2,3,4,5,6,7,8,9,10,11,12]

Now, if I want to take a slice of it, I can.
It may be done in,
>>> list2=list1[:3]
>>> print list2
[1, 2, 3]

If I want to iterate the list, I may do as,

>>> for i in list1:
print "Iterated Value Is:",i


Iterated Value Is: 1
Iterated Value Is: 2
Iterated Value Is: 3
Iterated Value Is: 4
Iterated Value Is: 5
Iterated Value Is: 6
Iterated Value Is: 7
Iterated Value Is: 8
Iterated Value Is: 9
Iterated Value Is: 10
Iterated Value Is: 11
Iterated Value Is: 12

Now, I want to combine iterator with a slicing condition like

>>> for i=list2 in list1:
print "Iterated Value Is:",i

So, that I get the list in the slices like,
[1,2,3]
[4,5,6]
[7,8,9]
[10,11,12]

But if I do this I get a Syntax Error, is there a solution?

If anyone of the learned members may kindly let me know?

Apology for any indentation error,etc. 

Thanking You in Advance,

Regards,
Subhabrata 




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problem with exam task for college

2013-01-13 Thread jeltedeproft
corrected a bit, loop works, gas doesn't work


from visual import *
import time
import math
import random
from datetime import datetime
import operator 


class lunar_lander(object):
def __init__(self):
scene.title = 'mini star wars'
scene.width = 375
scene.height = 550
scene.center = (0,0)
self.pos = (0,0)
self.axis = 0
self.brandstofmeter = brandstofmeter()
self.ruimteschip = ruimteschip()
self.view = game_view(self)



def play(self):
t=0
dt=0.01
self.ruimteschip.updatemeter = False
while t<9:
time.sleep(0.01)
self.ruimteschip.update(dt)
t = t + dt
if self.ruimteschip.updatemeter == True:
self.brandstofmeter.update





class game_view(object):
def __init__(self,owner):
autoscale=True
box(pos=( 0, -375, 0), length=500, height=5, width=0, color = 
color.white)
box(pos=(0,375, 0), length=500, height=5, width=0, color = color.white)
box(pos=(-250,0, 0), length=5, height=750, width=0, color = color.white)
box(pos=(250,0, 0), length=5, height=750, width=0, color = color.white)

maan = 
curve(pos=[(-250,-353),(-240,-341),(-210,-354),(-199.5,-374)],color=color.red)
maana = curve(pos=[(-199.5,-374),(-166,-374)],color=color.green)
maanb = 
curve(pos=[(-166,-374),(-140,-357),(-80,-319),(-40,-361),(0,-321),(40,-329),(80,-347)],color=color.red)
maanc = curve(pos=[(80,-347),(140,-347)],color=color.green)
maand = 
curve(pos=[(140,-347),(162,-337),(189.5,-365),(210,-355),(240,-372),(250,-338)],color=color.red)

for i in random.sample(range (-250,250),20):
for j in random.sample(range (-375,375),20):
sterren = points(pos = [i,j,0],size = 2, color=color.white)




class brandstofmeter(object):
def __init__(self):
axis = 0
self.pos = (210,345)
self.length = 25
self.height = 45
self.meter = box(pos = self.pos, length = self.length, height = 
self.height,color = color.green)
def update(self):
self.height = self.height - 0.2
print "ok"




class ruimteschip(object):
def __init__(self):
self.pos = vector(0,330)
self.acceleration = vector(0,-88,0)
self.axis = (1,0,0)
self.hoek = (90*math.pi)/180
self.graden = math.degrees(self.hoek)
self.gas = vector(10 * cos(self.hoek),10 * sin (self.hoek))
self.velocity = vector(0,0,0)
self.angle = pi / 2
self.updatemeter = False
self.view = ruimteschip_view(self)
self.vlam = self.view.vlam
self.frame = self.view.frame
self.zicht = brandstofmeter()



def update(self,dt):
self.velocity = self.velocity + (self.acceleration * dt)
self.pos = self.pos + self.velocity * dt

if scene.kb.keys:
key = scene.kb.getkey()
if key == "left":
# linkerafwijking
self.frame.axis -= (0, 0, 0.05)
self.gas = vector(-sin(self.angle), cos(self.angle))
self.vlam.visible = True
self.updatemeter = True

elif key == "right":
# rechterafwijking
self.frame.axis += (0, 0, 0.05)
self.gas = vector(sin(self.angle), cos(self.angle))

elif key == "up":
self.deviate()
self.vlam.visible = False
self.updatemeter = False

if self.pos.x > 250:
self.pos.x = -250
if self.pos.x < -250:
self.pos.x = 250
self.view.update(self)

def deviate(self):
# zet veranderde snelheid
self.frame.velocity += self.gas
self.frame.pos += self.frame.velocity
# Reset valsnelheid
self.frame.velocity -= self.gas


 


class ruimteschip_view(object):
def __init__(self,owner):
self.owner = owner
self.frame = frame(pos = owner.pos,axis = owner.axis)
self.motor = curve(frame = 
self.frame,pos=[(0,24.0),(22.0,24.0),(22.0,39.0),(-22.0,39.0),(-22,24),(0,24)])
self.capsule = curve(frame = self.frame,color = color.blue 
,pos=[(0,39),(-3,39),(-9,44),(-12,46),(-18,48),(-22,50),(-18,52),(-12,54),(-9,56),(-3,61),(0,61),(3,59),(9,56),(12,54),(18,52),(22,50),(18,48),(12,46),(9,44),(3,39),(0,39)])
self.poota = curve(frame = self.frame,pos = 
[(-18,24),(-20,24),(-20,0),(-18,0),(-18,24)])
self.pootb = curve(frame = self.frame,pos = 
[(18,24),(20,24),(20,0),(18,0),(18,24)])
self.vlam = curve(frame = self.frame,color = color.orange , 
visible=false,pos = [(0,24.0),(-9.0,14.0),(0,-5.0),(9,14.0),(0,24.0)])
  

Re: For Loop in List

2013-01-13 Thread Dave Angel
On 01/13/2013 07:45 AM, subhabangal...@gmail.com wrote:
> Dear Group,
>
> I have a list like,
>
 list1=[1,2,3,4,5,6,7,8,9,10,11,12]

What version of Python?

> Now, if I want to take a slice of it, I can.
> It may be done in,
 list2=list1[:3]
 print list2
> [1, 2, 3]
>
> If I want to iterate the list, I may do as,
>
 for i in list1:
>   print "Iterated Value Is:",i
>
>   
> Iterated Value Is: 1
> Iterated Value Is: 2
> Iterated Value Is: 3
> Iterated Value Is: 4
> Iterated Value Is: 5
> Iterated Value Is: 6
> Iterated Value Is: 7
> Iterated Value Is: 8
> Iterated Value Is: 9
> Iterated Value Is: 10
> Iterated Value Is: 11
> Iterated Value Is: 12
>
> Now, I want to combine iterator with a slicing condition like
>
 for i=list2 in list1:
>   print "Iterated Value Is:",i
>
> So, that I get the list in the slices like,
> [1,2,3]
> [4,5,6]
> [7,8,9]
> [10,11,12]
>
> But if I do this I get a Syntax Error, is there a solution?

It'd be only polite if you actually included the traceback, instead of
paraphrasing the error.

> If anyone of the learned members may kindly let me know?
>
> Apology for any indentation error,etc. 
>
> Thanking You in Advance,
>
> Regards,
> Subhabrata 
>
>   
>
>

let's examine the code that generates the syntax error.
for i=list2 in list1:

That doesn't match any of the grammar of Python, so it gives a syntax
error.  How could the compiler have interpreted it?  Perhaps it could
have thrown out the 'for' and the colon.  That would be equivalent in
this case to:
 i = False

or we could toss out the "=list2"   but that would give us your first loop.

If I were doing this, I'd do something like (untested):

temp = list1[:]   #make a shallow copy of the list, so we're not
modifying the original
while temp
print temp[:3]
temp = temp[3:]

I think you could do something similar with zip, but I don't have the
energy this morning.



-- 

DaveA

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: For Loop in List

2013-01-13 Thread Tim Chase

On 01/13/13 06:45, subhabangal...@gmail.com wrote:

Dear Group,

I have a list like,


list1=[1,2,3,4,5,6,7,8,9,10,11,12]


Now, if I want to take a slice of it, I can.
It may be done in,

list2=list1[:3]
print list2

[snip]

Now, I want to combine iterator with a slicing condition like


for i=list2 in list1:

print "Iterated Value Is:",i

So, that I get the list in the slices like,
[1,2,3]
[4,5,6]
[7,8,9]
[10,11,12]


Well, you get a SyntaxError because, well, it's a syntax error.  It 
may take a little math to do this:


>>> SIZE = 3
>>> for i in range(len(list1)//SICE):
... print list1[i*SIZE:i*SIZE+SIZE]
...
[1, 2, 3]
[4, 5, 6]
[7, 8, 9]
[10, 11, 12]

Or, you can exploit the fact that iterators exhaust inside a for-loop:

>>> i = iter(list1)
>>> for item in i:
... print [item, i.next(), i.next()]
...
[1, 2, 3]
[4, 5, 6]
[7, 8, 9]
[10, 11, 12]



Hope this helps,

-tkc



--
http://mail.python.org/mailman/listinfo/python-list


Re: For Loop in List

2013-01-13 Thread Boris FELD
2013/1/13 Tim Chase :
> On 01/13/13 06:45, subhabangal...@gmail.com wrote:
>
 SIZE = 3
 for i in range(len(list1)//SICE):
> ... print list1[i*SIZE:i*SIZE+SIZE]
> ...
> [1, 2, 3]
> [4, 5, 6]
> [7, 8, 9]
> [10, 11, 12]
>

A little shorter and simpler version:
>>> x = x[1:]
>>> for i in range(0,len(x),SIZE):
...  print x[i: i+SIZE]
...
[1, 2, 3]
[4, 5, 6]
[7, 8, 9]
[10, 11, 12]

Hope it helps

> Hope this helps,
>
> -tkc
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problem with exam task for college

2013-01-13 Thread jeltedeproft
this is again a newer version, right now the velocity does in fact turn, but 
the view doesn't follow, it keeps the ship vertical.

i'm also having trouble letting the flame appear when pressing the "up" button

and when the ship rotates the horizontal velocity keeps getting bigger and 
bigger

i also have to make the game end when the ship hits the moon on the wrong place

i'm kinda stressed out because this has to be done by the 15th i've been 
studying like crazy the past week. If anyone could help me out i will deeply 
appreciate it, here is the code 


from visual import *
import time
import math
import random
from datetime import datetime
import operator 


class lunar_lander(object):
def __init__(self):
scene.title = 'mini star wars'
scene.width = 375
scene.height = 550
scene.center = (0,0)
self.pos = (0,0)
self.axis = 0
self.brandstofmeter = brandstofmeter()
self.ruimteschip = ruimteschip()
self.view = game_view(self)



def play(self):
t=0
dt=0.01
self.ruimteschip.updatemeter = False
while t<9:
time.sleep(0.01)
self.ruimteschip.update(dt)
t = t + dt
if self.ruimteschip.updatemeter == True:
self.brandstofmeter.update





class game_view(object):
def __init__(self,owner):
autoscale=True
box(pos=( 0, -375, 0), length=500, height=5, width=0, color = 
color.white)
box(pos=(0,375, 0), length=500, height=5, width=0, color = color.white)
box(pos=(-250,0, 0), length=5, height=750, width=0, color = color.white)
box(pos=(250,0, 0), length=5, height=750, width=0, color = color.white)

maan = 
curve(pos=[(-250,-353),(-240,-341),(-210,-354),(-199.5,-374)],color=color.red)
maana = curve(pos=[(-199.5,-374),(-166,-374)],color=color.green)
maanb = 
curve(pos=[(-166,-374),(-140,-357),(-80,-319),(-40,-361),(0,-321),(40,-329),(80,-347)],color=color.red)
maanc = curve(pos=[(80,-347),(140,-347)],color=color.green)
maand = 
curve(pos=[(140,-347),(162,-337),(189.5,-365),(210,-355),(240,-372),(250,-338)],color=color.red)

for i in random.sample(range (-250,250),20):
for j in random.sample(range (-375,375),20):
sterren = points(pos = [i,j,0],size = 2, color=color.white)




class brandstofmeter(object):
def __init__(self):
axis = 0
self.pos = (210,345)
self.length = 25
self.height = 45
self.meter = box(pos = self.pos, length = self.length, height = 
self.height,color = color.green)
def update(self):
self.height = self.height - 0.2
print "ok"




class ruimteschip(object):
def __init__(self):
self.pos = vector(0,330)
self.acceleration = vector(0,-20,0)
self.axis = (1,0,0)
self.hoek = (90*math.pi)/180
self.graden = math.degrees(self.hoek)
self.gas = vector(10 * cos(self.hoek),10 * sin (self.hoek))
self.velocity = vector(0,0,0)
self.angle = pi / 2
self.updatemeter = False
self.view = ruimteschip_view(self)
self.vlam = self.view.vlam
self.frame = self.view.frame
self.zicht = brandstofmeter()



def update(self,dt):
self.velocity = self.velocity + (self.acceleration * dt)
self.pos = self.pos + self.velocity * dt
print self.velocity

if scene.kb.keys:
key = scene.kb.getkey()
if key == "left":
# linkerafwijking
self.frame.axis -= (0, 0, 0.05)
self.gas = vector(-sin(self.angle), cos(self.angle))
self.vlam.visible = True
self.updatemeter = True

elif key == "right":
# rechterafwijking
self.frame.axis += (0, 0, 0.05)
self.gas = vector(sin(self.angle), cos(self.angle))

elif key == "up":
self.velocity += self.gas
self.frame.pos += self.velocity
else:
self.vlam.visible = False
self.updatemeter = False
self.velocity -= self.gas

if self.pos.x > 250:
self.pos.x = -250
if self.pos.x < -250:
self.pos.x = 250
self.view.update(self)
 


class ruimteschip_view(object):
def __init__(self,owner):
self.owner = owner
self.frame = frame(pos = owner.pos,axis = owner.axis, velocity = 
owner.velocity)
self.motor = curve(frame = 
self.frame,pos=[(0,24.0),(22.0,24.0),(22.0,39.0),(-22.0,39.0),(-22,24),(0,24)])
self.capsule = curve(frame = self.frame,color = color.blue 
,pos=[(0,39),(-3,39),(-9,44),(-12,46),(-18,4

Re: For Loop in List

2013-01-13 Thread Tim Chase

On 01/13/13 07:48, Boris FELD wrote:

2013/1/13 Tim Chase :

SIZE = 3
for i in range(len(list1)//SICE):

... print list1[i*SIZE:i*SIZE+SIZE]


A little shorter and simpler version:

x = x[1:]
for i in range(0,len(x),SIZE):

...  print x[i: i+SIZE]


Doh, I always forget that range() takes an optional stride.  Or 
rather, I use it so infrequently that I reach for other alternatives 
before it occurs to me :)


-tkc



--
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: Python training "text movies"

2013-01-13 Thread Jason Friedman
> That is right; I would also add that it may be overwhelming for a newbie
> to be reading through a large "wall of text" -- here you have blank
> space after the current paragraph so the attention is focused even more
> on the last few lines.
>
> Additionally, since instructions scroll automatically, I can space them
> out more than you would conventionally do in a manual.
>

Pretty cool.
-- 
http://mail.python.org/mailman/listinfo/python-list


Creating continuous keystroke with python

2013-01-13 Thread Abhas Bhattacharya
I need to generate continuous keystroke with python. I have been trying with 
the sendkeys module, but the only command it supports is sending discrete 
keypresses. But I need a continous keypress, so that the other application 
(which in this case is a game which triggers an action only when a key is 
continously pressed for some time)can recognise it as such. Also I tried using 
the sendkeys function on pywin32 api, but it does the same thing too. My hope 
is there will be another function in pywin32 or some other api which can create 
seperate keydown event and keyup event so that I can bypass the keydown event 
for some time.
-- 
http://mail.python.org/mailman/listinfo/python-list


Keyboard hook in linux

2013-01-13 Thread K. Elo

Hi!

I am working on a small console app for linux. The idea is to display 
some sensor values and the screen should update itself in, say, every 10 
seconds.


The user should have the possibly to change some configurations or gwt 
help by pressing different keys (like you can do when running e.g. 
'top'). In other words: the program should NOT wait for the keypress (so 
input() is not the solution), but simply capture keypresses and act 
accordingly. If no key is pressed, the program should continue updating 
the screen.


Practically I am looking for something similar than Pascal's 
"keypressed" function 
(http://www.freepascal.org/docs-html/rtl/crt/keypressed.html). The 
python code would be something like this:


--- snip ---

while True:
  if keypressed:
ch=screen.getch()   # From 'curses'
# Test, if 'ch' is a valid key
# Do what the user want
  read_sensors()
  update_screen()

--- snip ---


I have searched in the Web and in several tutorials (e.g. "Programming 
python"), but this seems to be a tricky one. The 'pyHook' library seems 
to offer a keyboard hook manager, but 'pyHook' is not available for 
linux :( IMHO, the 'curses' library offers no (direct) solution to this...


Does anybody have an idea / a solution, how to capture keystrokes in linux?

Kind regards,
Kimmo
--
http://mail.python.org/mailman/listinfo/python-list


Re: Keyboard hook in linux

2013-01-13 Thread Michael Torrie
On 01/13/2013 09:13 AM, K. Elo wrote:
> I am working on a small console app for linux. The idea is to display 
> some sensor values and the screen should update itself in, say, every 10 
> seconds.
> 
> The user should have the possibly to change some configurations or gwt 
> help by pressing different keys (like you can do when running e.g. 
> 'top'). In other words: the program should NOT wait for the keypress (so 
> input() is not the solution), but simply capture keypresses and act 
> accordingly. If no key is pressed, the program should continue updating 
> the screen.

'top' is built using a programming library called 'curses' or 'ncurses.'
 That's likely where you'll need to go to.  At least if you want to be
able to run properly on different terminals.  ncurses handles terminal
output including writing text at certain positions, and input/output,
and even mouse interactions if you felt you needed that.  It's
apparently part of the standard python library:
http://docs.python.org/2/library/curses.html


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Keyboard hook in linux

2013-01-13 Thread Michael Torrie
On 01/13/2013 09:13 AM, K. Elo wrote:
> I have searched in the Web and in several tutorials (e.g. "Programming 
> python"), but this seems to be a tricky one. The 'pyHook' library seems 
> to offer a keyboard hook manager, but 'pyHook' is not available for 
> linux :( IMHO, the 'curses' library offers no (direct) solution to this...

You're wrong.  curses does offer a direct solution to this.  Check the
docs.  Also here's a nice intro document for Python 3:
http://docs.python.org/dev/howto/curses.html

You can check to see if a keystroke is waiting, grab it and then do
something useful.  curses can even grab keys like page up or page down.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problem with exam task for college

2013-01-13 Thread Oscar Benjamin
On 13 January 2013 13:57,   wrote:
> this is again a newer version, right now the velocity does in fact turn, but 
> the view doesn't follow, it keeps the ship vertical.
>
> i'm also having trouble letting the flame appear when pressing the "up" button
>
> and when the ship rotates the horizontal velocity keeps getting bigger and 
> bigger
>
> i also have to make the game end when the ship hits the moon on the wrong 
> place
>
> i'm kinda stressed out because this has to be done by the 15th i've been 
> studying like crazy the past week. If anyone could help me out i will deeply 
> appreciate it, here is the code
>
[SNIP]
>
> def update(self,dt):
> self.velocity = self.velocity + (self.acceleration * dt)
> self.pos = self.pos + self.velocity * dt
> print self.velocity
>
> if scene.kb.keys:
> key = scene.kb.getkey()
> if key == "left":
> # linkerafwijking
> self.frame.axis -= (0, 0, 0.05)
> self.gas = vector(-sin(self.angle), cos(self.angle))
> self.vlam.visible = True
> self.updatemeter = True
>
> elif key == "right":
> # rechterafwijking
> self.frame.axis += (0, 0, 0.05)
> self.gas = vector(sin(self.angle), cos(self.angle))
>
> elif key == "up":
> self.velocity += self.gas
> self.frame.pos += self.velocity
> else:
> self.vlam.visible = False
> self.updatemeter = False
> self.velocity -= self.gas
>
> if self.pos.x > 250:
> self.pos.x = -250
> if self.pos.x < -250:
> self.pos.x = 250
> self.view.update(self)
[SNIP]

The function above is poorly organised. You should break this into
several logical steps:
1) Process keypresses to update discrete state variables (such as
whether or not the ship is thrusting.
2) Compute from the discrete state variables of the system what the
acceleration will be, e.g.:
acceleration = gravity
if thrusting:
acceleration += gas
3) Only once the acceleration is known apply the formulas to update
the continuous state (position/velocity) of your system.

If you rearrange it like this then you will probably be able to fix
the logic bugs in the function above. In particular it is important
that there should be only one place where you actually change each
kind of state variable (velocity is modified in three places in the
function above and I'm sure that this is related to the bugs you are
having). Similar considerations apply to updating the angle of the
ship.

Also the update formula for the position is wrong. If I've understood
your physics correctly, you should be using the equations of constant
acceleration (my students know these as the "suvat" equations). In
that case the formula should look like:

newposition = oldposition + oldvelocity*dt + acceleration*dt**2
newvelocity = oldvelocity + acceleration*dt

Your code is missing the quadratic term at the end of the first line
above. (Actually the situation would be more complicated than this
when the ship is also rotating but I don't understand exactly what
your rotation physics is supposed to be).


Oscar
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: For Loop in List

2013-01-13 Thread Mitya Sirenef

On 01/13/2013 07:45 AM, subhabangal...@gmail.com wrote:

Dear Group,

I have a list like,


list1=[1,2,3,4,5,6,7,8,9,10,11,12]

Now, if I want to take a slice of it, I can.
It may be done in,

list2=list1[:3]
print list2

[1, 2, 3]

If I want to iterate the list, I may do as,


for i in list1:

print "Iterated Value Is:",i


Iterated Value Is: 1
Iterated Value Is: 2
Iterated Value Is: 3
Iterated Value Is: 4
Iterated Value Is: 5
Iterated Value Is: 6
Iterated Value Is: 7
Iterated Value Is: 8
Iterated Value Is: 9
Iterated Value Is: 10
Iterated Value Is: 11
Iterated Value Is: 12

Now, I want to combine iterator with a slicing condition like


for i=list2 in list1:

print "Iterated Value Is:",i

So, that I get the list in the slices like,
[1,2,3]
[4,5,6]
[7,8,9]
[10,11,12]

But if I do this I get a Syntax Error, is there a solution?

If anyone of the learned members may kindly let me know?

Apology for any indentation error,etc.

Thanking You in Advance,

Regards,
Subhabrata







Another good answer is to use a recipe from itertools docs page.
There are a lot of good recipes there and you may want to keep
them all in a module you can import from when needed. Here
is the recipe:

def grouper(n, iterable, fillvalue=None):
"""From itertools recipes: collect data into fixed-length chunks or 
blocks."""

# grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
return zip_longest(fillvalue=fillvalue, *args)

>>> list(grouper(3, range(12))
...
...
...
... )
[(0, 1, 2), (3, 4, 5), (6, 7, 8), (9, 10, 11)]


HTH, - mitya


--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint or similar to test version-specific language constructs?

2013-01-13 Thread jkn
Hi Dave

On 11 Jan, 15:06, Dave Angel  wrote:
>
> Not sure what you mean by beforehand.  Don't you run all your unit tests
> before putting each revision of your code into production?  So run those
> tests twice, once on 2.7, and once on 2.4.  A unit test that's testing
> code with a ternary operator will fail, without any need for a separate
> test.
>
> if it doesn't, then you've got some coverage gaps in your unit tests.

By 'beforehand' I meant 'before testing on my target 2.4 system;
perhaps I should have been clearer in that I am running 2.7 on my
'development' platform, and 2.4 on my target. It would be painful to
put 2.4 on my target system (although I continue to wonder about
that...). So I was looking to catch such errors before migrating to
the target.

[Steven D'Aprano]
> Decorators work fine in Python 2.4.

Yes, I was just coming up with another example of a language construct
which didn't exist at one point.

> You don't even need tests for the code that includes the ternary
> operator. The module simply won't compile in Python 2.4, you get a
> SyntaxError when you try to import it or run it.

In fact I had a misapprehension about this; for some reason (I thought
I'd tried it) I thought such an error only got caught at runtime, not
'compile-time'. I now see that this is not the case, which means the
athe problem is less of a concern than I thought.

Thanks for the comments.

Jon N
-- 
http://mail.python.org/mailman/listinfo/python-list


Upgrading Python with NumPy, SciPy and Mayavi in a Rocks 6.0 cluster

2013-01-13 Thread Patrick Haley

Hi,

We are looking for some guidance in installing an upgraded
Python on our cluster.  Our cluster was installed with Rocks 6.0,
is running CentOs 6.2, and has python-2.6.6, gcc-4.4.6.  We
would like to install an upgraded version of Python along with
the following modules

NumPy
Scipy   (which will require a compatible version of the Atlas libraries)
Mayavi  (which will require a compatible version of vtk)

We were wondering if anyone has experience in installing these
packages, what are the best combinations of compatible versions,
what other upgrades will be needed (e.g. will we need to
upgrade the gnu compilers to install the latest versions) and
where these should be installed (local disks, /share/apps, other?).

A little more background, our students are currently working
with a local installation using

Python-2.7.1
numpy-1.5.1
scipy-0.9.0b1
Mayavi-3.4.0
ATLAS-3.8.3
vtk-5.4

We would like to install these packages in a more
appropriate, cluster-wide area and upgrade these
packages as appropriate.  We are also aware of a
Rocks python roll which contains python-2.7.2 and
an upspecified version of NumPy (is it possible to
find out which version, before installing the roll?).

Thanks

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Pat Haley  Email: 
pha...@mit.edu
Center for Ocean Engineering Phone:(617) 253-6824
Dept. of Mechanical Engineering Fax:(617) 253-8125
MIT, Room 5-213  
http://web.mit.edu/phaley/www/
77 Massachusetts Avenue
Cambridge, MA  02139-4301

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Keyboard hook in linux

2013-01-13 Thread garabik-news-2005-05
K. Elo  wrote:
 
> Practically I am looking for something similar than Pascal's 
> "keypressed" function 

As already mentioned, (n)curses is a good solution.
However, if you need/want to go to lower levels, you can read
/dev/input/event* like this (excerpt from one of my programs):

def opendevs():
return [os.open(dev, os.O_RDONLY) for dev in glob.glob("/dev/input/event*")]

def readevent(fds):
try:
# file descriptor has disappeared - we unplugged the keyboard,
# resumed from suspend etc...
ps = [os.read(fd, 16) for fd in fds]
except OSError:
traceback.print_exc()
yield None, None, None
for p in ps:
timeval, suseconds, typ, code, value = struct.unpack( 'llHHI', p[:16])
yield typ, value, code

def run_print(fds):
while 1:
rs, ws, xs = select.select(fds, [], [])
for t, v, e in readevent(rs):
print "Event code:", e, "type:", t, "value:", v

fds = opendevs()
run_print(fds)


This is of course not portable at all (and won't run on ancient
Linuces), but the advantage is that you can hook to the keys or key
combinations curses cannot (e.g. modifiers, Scrolllock etc...) and the
program can react to the key events even in the background.

-- 
 ---
| Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__garabik @ kassiopeia.juls.savba.sk |
 ---
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Keyboard hook in linux

2013-01-13 Thread K. Elo

Hi!

Thanks, Michael, for your quick - and heplful - reply.

13.01.2013 18:46, Michael Torrie wrote:

You're wrong.  curses does offer a direct solution to this.  Check the
docs.  Also here's a nice intro document for Python 3:
http://docs.python.org/dev/howto/curses.html


You are right :) The docs tell us (I somehow missed this when reading 
the doc last time):


"It’s possible to change this behavior with the method nodelay(). After 
nodelay(1), getch() for the window becomes non-blocking and returns 
curses.ERR (a value of -1) when no input is ready. There’s also a 
halfdelay() function, which can be used to (in effect) set a timer on 
each getch(); if no input becomes available within a specified delay 
(measured in tenths of a second), curses raises an exception."


This is actually funny: if you google for e.g. "capture keystrokes 
python", you will find masses of suggestions, none of them having this 
simple and elegant (i.e. python-like :) ) solution included.


Now it works and my problem is solved. Thank you!

Kind regards,
Kimmo

--
http://mail.python.org/mailman/listinfo/python-list


Subgraph Drawing

2013-01-13 Thread subhabangalore
Dear Group,

I have two questions, if I take a subseries of the matrix as in eigenvalue here,
provided I have one graph of the full form in G, how may I show it, as if I do 
the nx.draw(G) it takes only the original graph. 

>>> import numpy
>>> import networkx as nx
>>> import matplotlib.pyplot as plt
>>> G=nx.Graph()
>>> G.add_edges_from([(1,2),(1,3),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8)])
>>> L =nx.laplacian(G)
>>> print L
[[ 7. -1. -1. -1. -1. -1. -1. -1.]
 [-1.  1.  0.  0.  0.  0.  0.  0.]
 [-1.  0.  1.  0.  0.  0.  0.  0.]
 [-1.  0.  0.  1.  0.  0.  0.  0.]
 [-1.  0.  0.  0.  1.  0.  0.  0.]
 [-1.  0.  0.  0.  0.  1.  0.  0.]
 [-1.  0.  0.  0.  0.  0.  1.  0.]
 [-1.  0.  0.  0.  0.  0.  0.  1.]]
>>> print numpy.linalg.eigvals(L)
[  8.e+00   2.22044605e-16   1.e+00   1.e+00
   1.e+00   1.e+00   1.e+00   1.e+00]

for more than 1000 nodes it is coming too slow on Windows 7 machine with 3GB 
RAM.

If any one of the learned members can help.

Apology for any indentation error etc.

Thanking all in Advance,

Regards,
Subhabrata Banerjee.
-- 
http://mail.python.org/mailman/listinfo/python-list


please solve my problem

2013-01-13 Thread Divya Thakur
hello i need help for my ecommerce project ,and here i am facing some problem 
here is my 

query
"i want to show image by the help of MEDIA_URL and this is my template file 
code for this
http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
#MEDIA_ROOT = "C:/Users/rakesh/Desktop/ecomstore/static/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/";, "http://example.com/media/";
MEDIA_URL = '/static/'
#MEDIA_URL = "http://localhost:8000/static/";

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/";
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
#"C:Users/rakesh/Desktop/ecomstore/static/"
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = '2h(8t+9z4z-m(fuhl17eqp78q!yxo4&i54jofml3uoyv@a3y3x'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
#'djangodblog.DBLogMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'ecomstore.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'ecomstore.wsgi.application'

TEMPLATE_DIRS = (   
os.path.join(CURRENT_PATH,'templates'),
"C:/Users/rakesh/Desktop/ecomstore/templates/",
#"C:/Python27/Lib/site-packages/django/contrib/admin/templates/admin",
# Put strings here, like "/home/html/django_templates" or 
"C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'catalog',
#'djangodblog',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
'preview',
'utils',
)

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail

Re: please solve my problem

2013-01-13 Thread Roy Smith
In article <72e8aec3-4fa3-44af-aad7-8b32196da...@googlegroups.com>,
 Divya Thakur  wrote:

> "i want to show image by the help of MEDIA_URL and this is my template file 
> code for this
>  not working 


This is a django-specific question.  You would do better to ask on the 
django-users mailing list:

https://groups.google.com/forum/?fromgroups#!forum/django-users
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: please solve my problem

2013-01-13 Thread Chris Angelico
On Mon, Jan 14, 2013 at 7:35 AM, Divya Thakur
 wrote:
> raise TemplateDoesNotExist(name)
> TemplateDoesNotExist: 500.html
> [14/Jan/2013 01:08:11] "GET /static/images/products/thumbnails/12345 
> HTTP/1.1" 500 59

This sounds like a Django-specific issue. You'll probably get better
results from a more Django-specific list:

https://www.djangoproject.com/community/

> here is my settings.py file
> # Make this unique, and don't share it with anybody.
> SECRET_KEY = '2h(8t+9z4z-m(fuhl17eqp78q!yxo4&i54jofml3uoyv@a3y3x'

You've just dumped a huge amount of text to us, including something
that probably shouldn't have been shared. I strongly recommend you
change this key, now that it's gone public, and consider trimming your
text down to just what's needed to reproduce the problem.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint or similar to test version-specific language constructs?

2013-01-13 Thread Chris Angelico
On Mon, Jan 14, 2013 at 4:56 AM, jkn  wrote:
> Hi Dave
>
> On 11 Jan, 15:06, Dave Angel  wrote:
>>
>> Not sure what you mean by beforehand.  Don't you run all your unit tests
>> before putting each revision of your code into production?  So run those
>> tests twice, once on 2.7, and once on 2.4.  A unit test that's testing
>> code with a ternary operator will fail, without any need for a separate
>> test.
>>
>> if it doesn't, then you've got some coverage gaps in your unit tests.
>
> By 'beforehand' I meant 'before testing on my target 2.4 system;
> perhaps I should have been clearer in that I am running 2.7 on my
> 'development' platform, and 2.4 on my target. It would be painful to
> put 2.4 on my target system (although I continue to wonder about
> that...). So I was looking to catch such errors before migrating to
> the target.

Painful to put 2.4 on your dev, you mean? I've never done it, but I
would expect that the old sources will compile against newer libraries
with no problems.

That's likely to be the easiest option. It's the language-level
equivalent of watching for a thrown exception rather than asking
forgiveness beforehand :)

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: please i need explanation

2013-01-13 Thread Walter Hurry
On Sun, 13 Jan 2013 15:04:34 -0600, Tony the Tiger wrote:

> On Fri, 11 Jan 2013 09:35:10 -0600, kwakukwatiah wrote:
> 
>> 
>> 
>> 
>> 
>> def factorial(n):
> 
> Right, another html junkie, on windoze, no doubt.

X-Mailer: Microsoft Windows Live Mail 15.4.3508.1109

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Subgraph Drawing

2013-01-13 Thread Oscar Benjamin
On 13 January 2013 20:05,   wrote:
> Dear Group,
>
> I have two questions, if I take a subseries of the matrix as in eigenvalue 
> here,
> provided I have one graph of the full form in G, how may I show it, as if I 
> do the nx.draw(G) it takes only the original graph.

I'm sorry, but I really don't understand what you mean. When you say
"subseries" do you mean "subgraph"? Or do you mean a subset of the
eigenvalues?

It would be good if you could give a simple example of what you mean
using code and showing the expected/desired output.

>
 import numpy
 import networkx as nx
 import matplotlib.pyplot as plt
 G=nx.Graph()
 G.add_edges_from([(1,2),(1,3),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8)])
 L =nx.laplacian(G)
 print L
> [[ 7. -1. -1. -1. -1. -1. -1. -1.]
>  [-1.  1.  0.  0.  0.  0.  0.  0.]
>  [-1.  0.  1.  0.  0.  0.  0.  0.]
>  [-1.  0.  0.  1.  0.  0.  0.  0.]
>  [-1.  0.  0.  0.  1.  0.  0.  0.]
>  [-1.  0.  0.  0.  0.  1.  0.  0.]
>  [-1.  0.  0.  0.  0.  0.  1.  0.]
>  [-1.  0.  0.  0.  0.  0.  0.  1.]]
 print numpy.linalg.eigvals(L)
> [  8.e+00   2.22044605e-16   1.e+00   1.e+00
>1.e+00   1.e+00   1.e+00   1.e+00]
>
> for more than 1000 nodes it is coming too slow on Windows 7 machine with 3GB 
> RAM.

What is too slow?


Oscar
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Subgraph Drawing

2013-01-13 Thread Steven D'Aprano
On Sun, 13 Jan 2013 12:05:54 -0800, subhabangalore wrote:

> Dear Group,
> 
> I have two questions, if I take a subseries of the matrix as in
> eigenvalue here, provided I have one graph of the full form in G, how
> may I show it, as if I do the nx.draw(G) it takes only the original
> graph.

Is this what you mean? If not, you will have to explain your question 
better.


L = = nx.laplacian(G)
E = numpy.linalg.eigvals(L)
nx.draw(E)


> >>> print numpy.linalg.eigvals(L)
> [  8.e+00   2.22044605e-16   1.e+00   1.e+00
>1.e+00   1.e+00   1.e+00   1.e+00]
> for more than 1000 nodes it is coming too slow on Windows 7 machine with
> 3GB RAM.

Get a faster machine. Or use fewer nodes. Or be patient and wait.

Solving a graph problem with 1000 nodes is a fairly big problem for a 
desktop PC. It will take time. Calculations don't just happen instantly, 
the more work you have to do the longer they take.

The last alternative is to ask on a specialist numpy list. But I expect 
they will probably tell you the same thing.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beowulf clusters

2013-01-13 Thread Mark Janssen
On Sun, Jan 13, 2013 at 8:19 PM, Oscar Benjamin
 wrote:
> On 14 January 2013 02:10, Mark Janssen  wrote:
>> Has anyone used python for high-performance computing on Beowulf clusters?
>
> Yes.

How did they deal with the Global interpreter lock across many machines?

Cheers,

Mark
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beowulf clusters

2013-01-13 Thread Oscar Benjamin
On 14 January 2013 02:22, Mark Janssen  wrote:
> On Sun, Jan 13, 2013 at 8:19 PM, Oscar Benjamin
>  wrote:
>> On 14 January 2013 02:10, Mark Janssen  wrote:
>>> Has anyone used python for high-performance computing on Beowulf clusters?
>>
>> Yes.
>
> How did they deal with the Global interpreter lock across many machines?

Unless I've drastically misunderstood something there is no GIL across
many machines. The GIL is a per-process lock so there is a different
GIL for each process on the same machine and there is no interaction
between the GILs on the same, or on different, machines.


Oscar
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beowulf clusters

2013-01-13 Thread Oscar Benjamin
On 14 January 2013 02:46, Mark Janssen  wrote:
> On Sun, Jan 13, 2013 at 8:37 PM, Oscar Benjamin
>  wrote:
>> On 14 January 2013 02:33, Mark Janssen  wrote:
>>> Lol, well that's why I'm asking.  I don't see how they can do it
>>> without considerable difficulties.
>>
>> What do you want the GIL for across machines? The normal purpose of
>> the GIL is to preserve the integrity of Python's in-memory data
>> structures. These are only accessible within one process so what good
>> would a multi-process GIL be?
>
> Excuse me, I actually thought you knew what you were talking about.

Steady on...

> A Beowulf cluster, by it's nature, is across many-machines.  Now you
> can't have a GIL and a single python program across many-machines
> without some tricks.  I'm just wondering how (or if) they solved that
> problem

You've used the word 'program'. I used the word 'process'. I have used
HPC clusters that I assume count as Beowulf clusters. However, I have
never used them in such a way that a single process occurred on
multiple machines (the idea seems absurd to me). Maybe I've missed
something here...


Oscar
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beowulf clusters

2013-01-13 Thread Mark Janssen
On Sun, Jan 13, 2013 at 8:37 PM, Oscar Benjamin
 wrote:
> On 14 January 2013 02:33, Mark Janssen  wrote:
>> Lol, well that's why I'm asking.  I don't see how they can do it
>> without considerable difficulties.
>
> What do you want the GIL for across machines? The normal purpose of
> the GIL is to preserve the integrity of Python's in-memory data
> structures. These are only accessible within one process so what good
> would a multi-process GIL be?

Excuse me, I actually thought you knew what you were talking about.  A
Beowulf cluster, by it's nature, is across many-machines.  Now you
can't have a GIL and a single python program across many-machines
without some tricks.  I'm just wondering how (or if) they solved that
problem

mark
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beowulf clusters

2013-01-13 Thread Craig Yoshioka
When you write HPC code the GIL isn't an issue, but you'll have plenty of 
others. 

Craig reporting from the road
10550 N Torrey Pines Rd
La Jolla CA 92037
work: 858 784 9208
cell: 619 623 2233

On Jan 13, 2013, at 6:22 PM, Mark Janssen  wrote:

> On Sun, Jan 13, 2013 at 8:19 PM, Oscar Benjamin
>  wrote:
>> On 14 January 2013 02:10, Mark Janssen  wrote:
>>> Has anyone used python for high-performance computing on Beowulf clusters?
>> 
>> Yes.
> 
> How did they deal with the Global interpreter lock across many machines?
> 
> Cheers,
> 
> Mark
> -- 
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Subgraph Drawing

2013-01-13 Thread subhabangalore
On Monday, January 14, 2013 6:05:49 AM UTC+5:30, Steven D'Aprano wrote:
> On Sun, 13 Jan 2013 12:05:54 -0800, subhabangalore wrote:
> 
> 
> 
> > Dear Group,
> 
> > 
> 
> > I have two questions, if I take a subseries of the matrix as in
> 
> > eigenvalue here, provided I have one graph of the full form in G, how
> 
> > may I show it, as if I do the nx.draw(G) it takes only the original
> 
> > graph.
> 
> 
> 
> Is this what you mean? If not, you will have to explain your question 
> 
> better.
> 
> 
> 
> 
> 
> L = = nx.laplacian(G)
> 
> E = numpy.linalg.eigvals(L)
> 
> nx.draw(E)
> 
> 
> 
> 
> 
> > >>> print numpy.linalg.eigvals(L)
> 
> > [  8.e+00   2.22044605e-16   1.e+00   1.e+00
> 
> >1.e+00   1.e+00   1.e+00   1.e+00]
> 
> > for more than 1000 nodes it is coming too slow on Windows 7 machine with
> 
> > 3GB RAM.
> 
> 
> 
> Get a faster machine. Or use fewer nodes. Or be patient and wait.
> 
> 
> 
> Solving a graph problem with 1000 nodes is a fairly big problem for a 
> 
> desktop PC. It will take time. Calculations don't just happen instantly, 
> 
> the more work you have to do the longer they take.
> 
> 
> 
> The last alternative is to ask on a specialist numpy list. But I expect 
> 
> they will probably tell you the same thing.
> 
> 
> 
> 
> 
> -- 
> 
> Steven

Dear Steven,

Thank you for your kind effort. You got the problem right. But it is giving 
following error,
Traceback (most recent call last):
  File "", line 1, in 
nx.draw(E)
  File "C:\Python27\lib\site-packages\networkx\drawing\nx_pylab.py", line 138, 
in draw
draw_networkx(G,pos=pos,ax=ax,**kwds)
  File "C:\Python27\lib\site-packages\networkx\drawing\nx_pylab.py", line 267, 
in draw_networkx
pos=nx.drawing.spring_layout(G) # default to spring layout
  File "C:\Python27\lib\site-packages\networkx\drawing\layout.py", line 241, in 
fruchterman_reingold_layout
A=nx.to_numpy_matrix(G,weight=weight)
  File "C:\Python27\lib\site-packages\networkx\convert.py", line 492, in 
to_numpy_matrix
nodelist = G.nodes()
AttributeError: 'numpy.ndarray' object has no attribute 'nodes'
>>> 

there are other solution of converting back the matrix to graph should I try 
that?

Regards,
Subhabrata. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Subgraph Drawing

2013-01-13 Thread Steven D'Aprano
On Sun, 13 Jan 2013 20:01:21 -0800, subhabangalore wrote:

> there are other solution of converting back the matrix to graph should I
> try that?

Yes.

-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyWart: Module access syntax

2013-01-13 Thread Rick Johnson
On Saturday, January 12, 2013 12:45:03 AM UTC-6, Steven D'Aprano wrote:
> On Fri, 11 Jan 2013 20:34:20 -0800, Rick Johnson wrote:
> > [...]
> So what do you do for, say, os.path? According to the first rule, you 
> must write it as os:path because path is a module; according to the 
> second rule, you must write it as os.path because path is a member of os. 
> So which rule wins?

Since "path" is an identifier in the module "os" that points to a system 
specific module (which is loaded at run-time), you would access os.path just as 
you do today; using the dot. No changes here. Next!

> If I do this:
> 
> import math
> import string
> math.string = string
>  
> is that legal, or do I have to write "math:string = string"?

No. You are assigning the module "string" to a member variable of the module 
"math" so you use the dot. No changes here. Next!

> Suppose I do this:

*rolls-eyes*

> import random
> if random.random() < 0.5:
> math.string = "NOBODY expects the Spanish Inquisition!"
> else:
> math.string = string  # assuming this actually is allowed

...first allow me to remove all the cruft so you can ask this next iteration of 
the _same_ hypothetical question succinctly.

if some_condition:
math.string = ""
else
math.string = string

> How do I access the string member?

You access the member variable named "string" (that points to the "string 
module") as you would ANY _member_,  using the dot. Next!

> try:
> print math.string  # only works if string is a str object
> except SomeException:
> print math:string  # only works if string is a module object

EARTH TO STEVEN: You are sadly misunderstanding my suggested syntax and frankly 
making a complete fool of yourself. I cannot allow this to go on any longer.

> That would suck *and* blow at the same time. 

Yes it would, but that's only _IF_ my suggested syntax works in the backwards 
way you suggest. Lucky for us, i'm designing this feature.

> I don't need to know the 
> type of any other member object in order to look it up, why should I have 
> to care whether it is a module?

I said it before and i'll say it again: If you don't know if your calls are 
accessing module space or object space (be it instanced object or static 
object), then you are sadly informed and shooting from the hip -- you're going 
to shoot your toes off! But that is not the worst part, no. The worst part is 
that by using only the dot, your code is superfluously obfuscated. That is a 
crime to me. A crime punishable by the syntax error. I condemn you to tortuous 
syntax errors until you change your rebellious ways.

> Now, suppose I then do this:
> 
> class Blob: pass
> 
> blob = Blob()
> blob.math = math  # or should that be blob:math ?

Oh lord. 

Has anyone noticed that every one of these hypotheticals is presenting the very 
same question using different circumstances. Do you think 1+1 will sometimes 
equal 2 Steven?

You are missing the point of this syntax. The colon is to access MODULE 
NAMESPACE. The dot is to access MODULE MEMBERS. A module CAN BE another 
module's MEMBER. 

You are also unable to grasp this simple logical fact: Once you arrive at /any/ 
MODULE and you start accessing MEMBERS, you will *_ALWAYS_* find members from 
that point downwards. 

Observe:

In module "lib:foo":
import string
import math
import math as _math
from math import ceil
#
string.math = math
string.math.var="var"


In __main__ (test 1):
import lib:foo
import lib:foo as foo
# Test 1
print lib:foo.string.math.var -> "var"
# Test 2
print foo.string.math.var -> "var"
# Test 3
foo.string.math.ceil(.1) -> 1.0
# Test 4:
foo.ceil(.1) -> 1.0

> [...]
>
> > Traceback (most recent call last):
> >   File "", line 1, in 
> > dlg = lib:gui:tkinter:dialogs.simpledialog()
> 
> 
> Of course it is an object. *Everything* in Python is an object. 

And i agree! ("it" being "modules" in this case)

> Modules 
> are objects. Strings are objects. Types and classes are objects.

Wait, "classes" are NOT objects. Classes are structured code that DEFINE an 
object. You see, this is exactly why we need to stop using the word "class" to 
describe an "object definition". Your ability to grasp _what_ an object 
definition *IS* is due to poor terminology. 

> None is 
> an object. Metaclasses are objects. Properties are objects. Exceptions 
> are objects. Have I made it clear yet?

Yes, but your point is invalid. I was comparing a module to an object. And even 
though EVERYTHING in Python is technically an object, you should have inferred 
the meaning of my comparison, but alas, you cannot even infer my syntax!

> > *The problem:*
> > ... is readability. The current dot syntax used ubiquitously in paths is
> > not conveying the proper information to the reader, and in-fact
> > obfuscating the code.
> 
> So you say. I think you are caring too much about the type of members and 
> not enough about what interface th

An Introduction to Stochastic Modeling 3rd Ed by Taylor, Karlin

2013-01-13 Thread kalvinmanual
I have solutions manuals to all problems and exercises in these textbooks. To 
get one in an electronic format contact me at: kalvinmanual(at)gmail(dot)com 
and let me know its title, author and edition. Please this service is NOT free.

SOLUTIONS MANUAL TO A First Course in Differential Equations  (7th ed.)  Zill & 
 Diferential Equations  (5th ed.)Zill & Cullen 
SOLUTIONS MANUAL TO 2500 Solved Problems in Fluid Mechanics & Hydraulics 
Schaums by Evett, cheng Liu
SOLUTIONS MANUAL TO A Course in Game Theory by Osborne, Rubinstein
SOLUTIONS MANUAL TO A Course in Modern Mathematical Physics by Peter Szekeres
SOLUTIONS MANUAL TO A Course in Ordinary Differential Equations by Swift, Wirkus
SOLUTIONS MANUAL TO A First Course in Abstract Algebra (7th Ed., John B. 
Fraleigh)  
SOLUTIONS MANUAL TO A First Course in Differential Equations -  The Classic 
Fifth Edition By Zill, Dennis G
SOLUTIONS MANUAL TO A First Course in Differential Equations, 9th Ed by Dennis 
G. Zill
SOLUTIONS MANUAL TO A First Course In Probability 7th Edition by Sheldon M. Ross
SOLUTIONS MANUAL TO A First Course in Probability Theory, 6th edition, by S. 
Ross.
SOLUTIONS MANUAL TO A First Course in String Theory, 2004, Barton Zwiebach
SOLUTIONS MANUAL TO A First Course in the Finite Element Method, 4th Edition  
logan
SOLUTIONS MANUAL TO A Practical Introduction to Data Structures and Algorithm 
Analysis 2Ed by Shaffer
SOLUTIONS MANUAL TO A Quantum Approach to Condensed Matter Physics (Philip L. 
Taylor & Olle Heinonen)
SOLUTIONS MANUAL TO A Short Course in General Relativity 2e by J. Foster and J. 
D. Nightingale
SOLUTIONS MANUAL TO A Short Introduction to Quantum Information and Quantum 
Computation by Michel Le Bellac
SOLUTIONS MANUAL TO A Transition to Advanced Mathematics 5th E by Smith, Eggen, 
Andre 
SOLUTIONS MANUAL TO Accounting Principles 8e by Kieso, Kimmel
SOLUTIONS MANUAL TO Accounting principles 8th Ed by Weygandt
SOLUTIONS MANUAL TO Accounting, 23 Ed by Carl S. Warren, James M. Reeve, 
Jonathan Duchac
SOLUTIONS MANUAL TO Accounting,8th Ed by Horngren,Harrison, Oliver
SOLUTIONS MANUAL TO Adaptive Control, 2nd. Ed., by Astrom, Wittenmark
SOLUTIONS MANUAL TO Adaptive Filter Theory (4th Ed., Simon Haykin)
SOLUTIONS MANUAL TO Advanced Accounting 10E international ED by Beams , 
Clement, Anthony, Lowensohn
SOLUTIONS MANUAL TO Advanced accounting 9th Ed by Hoyle, Schaefer
SOLUTIONS MANUAL TO Advanced Calculus Gerald B. Folland
SOLUTIONS MANUAL TO Advanced Digital Design with the Verilog HDL by Michael D. 
Ciletti
SOLUTIONS MANUAL TO Advanced Dynamics (Greenwood)
SOLUTIONS MANUAL TO Advanced Engineering Electromagnetics by Constantine A. 
Balanis
SOLUTIONS MANUAL TO Advanced Engineering Mathematics 3rd ed zill
SOLUTIONS MANUAL TO Advanced Engineering Mathematics 8Ed Erwin Kreyszig
SOLUTIONS MANUAL TO Advanced Engineering Mathematics by Erwin Kreyszig, 9th ed
SOLUTIONS MANUAL TO Advanced Engineering Mathematics, 6th Edition by Peter V. 
O'Neil
SOLUTIONS MANUAL TO Advanced Engineering Mathematics,2E, by Zill, Cullen
SOLUTIONS MANUAL TO Advanced Engineering Thermodynamics, 3rd Edition by Adrian 
Bejan
SOLUTIONS MANUAL TO Advanced Financial Accounting  by Baker
SOLUTIONS MANUAL TO Advanced Financial Accounting 5 Ed by Baker 
SOLUTIONS MANUAL TO Advanced Financial Accounting 8th Ed by Baker
SOLUTIONS MANUAL TO Advanced Industrial Economics by Martin
SOLUTIONS MANUAL TO Advanced Industrial Economics, 2nd ED Stephen Martin
SOLUTIONS MANUAL TO Advanced Macroeconomics 2nd edition  by David Romer
SOLUTIONS MANUAL TO Advanced Macroeconomics, by David Romer
SOLUTIONS MANUAL TO Advanced Mechanics of Materials 6th ed by Boresi, Schmidt
SOLUTIONS MANUAL TO Advanced Modern Engineering Mathematics 3rd Ed Glyn James
SOLUTIONS MANUAL TO Advanced Modern Engineering Mathematics 4th Ed Glyn James
SOLUTIONS MANUAL TO Advanced Modern Engineering Mathematics, 3rd Ed., by G. 
James
SOLUTIONS MANUAL TO Advanced Organic Chemistry Part A- Structure and Mechanisms 
5th E by Carey, Sundberg
SOLUTIONS MANUAL TO Aircraft Structures for Engineering Students (4th Ed., 
T.H.G. Megson)
SOLUTIONS MANUAL TO Algebra & Trigonometry and Precalculus, 3rd Ed By Beecher, 
Penna, Bittinger
SOLUTIONS MANUAL TO Algebra Baldor
SOLUTIONS MANUAL TO Algebra-By Thomas W. Hungerford
SOLUTIONS MANUAL TO Algorithm Design (Jon Kleinberg & ?‰va Tardos) 
SOLUTIONS MANUAL TO An Interactive Introduction to Mathematical Analysis 2nd E 
(Jonathan Lewin)
SOLUTIONS MANUAL TO An Introduction To Analysis 4th Ed by William Wade
SOLUTIONS MANUAL TO An Introduction to Database Systems (8th Ed., C.J. Date)
SOLUTIONS MANUAL TO An Introduction to Economic Dynamics by Ronald Shone 
SOLUTIONS MANUAL TO An Introduction to Modern Astrophysics (2nd Ed., Bradley W. 
Carroll & Dale A. Ostlie)
SOLUTIONS MANUAL TO An Introduction to Numerical Analysis By Endre Süli,David 
F. Mayers
SOLUTIONS MANUAL TO An Introduction to Ordinary Differential Equations (James 
C. Robinson)
SOLUTIONS MANUAL TO An Introduction to Si

Re: ANN: Python training "text movies"

2013-01-13 Thread Franck Ditter
In article ,
 Jason Friedman  wrote:

> > That is right; I would also add that it may be overwhelming for a newbie
> > to be reading through a large "wall of text" -- here you have blank
> > space after the current paragraph so the attention is focused even more
> > on the last few lines.
> >
> > Additionally, since instructions scroll automatically, I can space them
> > out more than you would conventionally do in a manual.
> >
> 
> Pretty cool.

When reading the source of the Web page which shows the scroll,
I can't find the reference to the text displayed. Only "text"...
How may we use the software which generates the Javascript ?
Thanks, it's cool.

franck
-- 
http://mail.python.org/mailman/listinfo/python-list


PyWart (Terminolgy): "Class"

2013-01-13 Thread Rick Johnson

I have believed for a very long time that "class" was a poor choice of keyword 
to designate an "object definition".

Firstly, the word /class/ does not transform smoothly into CS from English. NO 
English definition of "class" comes anywhere close to describing the 
"structured source code that defines an object".  Or even generally as: 
"something that defines something else". You could try to hammer 
"classification" into the round hole, but you soon find out it's just a damn 
square peg!

Secondly, "class" is confusing to newbies. How can someone understand the 
fundamentals of OOP (which defines objects and interfaces) when they are asked 
to write classes?  (teacher:) "Okay /class/, we are going to create a new 
object by writing a class." (student:) HUH?

Thirdly, once people *DO* understand that a "class" is simply an "object 
definition", they still go on to say idiotic things like: "Classes are 
objects"! It is obvious these people are a victim of their own terminology.


Other possible terms include:


"subclass":
Since every "user defined object" *must* subclass /something/, using this 
word would infer such a relationship to the reader. HOWEVER, we would then need 
to differentiate the general usage of "subclass" (as in: an object that is an 
extension of another object) from a "user defined subclass" (as in: source 
code). In any event, "subclass" is a good contender. He's going to the 12th 
round for sure.

"template":
This term is very close, but still lacking a concrete relationship between 
source code (definition of object) and the resulting "thing" living in memory 
(object). I think this one is TKO in round 3.

"object":
This is my favorite word however it does suffer a "verbial" disconnection. 
What are we suggesting? A single word can be very ambiguous as to intent. 
However, if we couple the word "object" with the word "define" we then inject 
intent. "define object" on it's face is perfect! We know everything we need to 
know. 1) We are defining "something" and 2) that *THAT* "something" is an 
object! YAY!

Now since "methods" and "functions" (PyWart on these terms coming soon!) 
require defining, the syntax will now be symmetrical (omitting for now that 
funcs/meths only use "def"!). However we could drop the "def" and use only 
"object" to save a few keystrokes and a lot of pyparsing.

I am sure the main arguments against such a clear and logical syntax would be 
that we would confuse "object definitions" with "real live objects" in normal 
conversation. But i say that is non-sense because we NEED to be more specific 
when conversing anyway. Choosing a word like "class" just because we don't want 
to use two words to refer to "source code that defines an object" (in 
conversation) is ridiculous. This syntax will inject specificity into our 
communications and convey meaning more appropriately.

Dear language designers: Stop propagating such foolish terminology! End the 
infection of "class" in all source code, docs, and daily conversation. Be more 
consistent and logical. Resist temptation to use poor terminology simply 
because other languages have done so before you. Grow a pair already!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: Python training "text movies"

2013-01-13 Thread Mitya Sirenef

On 01/14/2013 01:34 AM, Franck Ditter wrote:

In article ,
  Jason Friedman  wrote:


That is right; I would also add that it may be overwhelming for a newbie
to be reading through a large "wall of text" -- here you have blank
space after the current paragraph so the attention is focused even more
on the last few lines.

Additionally, since instructions scroll automatically, I can space them
out more than you would conventionally do in a manual.


Pretty cool.

When reading the source of the Web page which shows the scroll,
I can't find the reference to the text displayed. Only "text"...
How may we use the software which generates the Javascript ?
Thanks, it's cool.

 franck


Thanks!

 the text is in var commands = ...

You can download the generator script here:

https://github.com/pythonbyexample/PBE/blob/master/code/jstmovie.py

(you also need to grab  tmovies dir)



--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

--
http://mail.python.org/mailman/listinfo/python-list


Re: PyWart (Terminolgy): "Class"

2013-01-13 Thread Chris Angelico
On Mon, Jan 14, 2013 at 5:46 PM, Rick Johnson
 wrote:
> Dear language designers: Stop propagating such foolish terminology! End the 
> infection of "class" in all source code, docs, and daily conversation. Be 
> more consistent and logical. Resist temptation to use poor terminology simply 
> because other languages have done so before you. Grow a pair already!

Absolutely. We should learn from Lars Pensjö and start referring to
"blueprint objects" and "clones". Or take the updated version and call
them "programs" and "objects". I'm sure that'll make a huge amount
more sense than using the terms that millions of programmers already
understand.

Alternatively, we could take the Humpty Dumpty approach and assign
meanings to names arbitrarily. But wait till Saturday night when they
come for their wages.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyWart (Terminolgy): "Class"

2013-01-13 Thread Rick Johnson
On Monday 1-14-2013 at 12:46 AM, Rick Johnson wrote:
> [...]
> "object":
> 
> This is my favorite word however it does suffer a
> "verbial" disconnection. What are we suggesting? A single
> word can be very ambiguous as to intent. However, if we
> couple the word "object" with the word "define" we then
> inject intent. "define object" on it's face is perfect! 

I just had an epiphany of sorts. 

I really don't like using two words ("define object", or "def obj") and using 
one single keyword is ambiguous ("object" or "obj"). So the obvious solution is 
to combine the abbreviated words into one compound keyword that will save 
keystrokes, save parsing, and all-the-while maintain symmetry. That keyword is 
"defobj". Coupled with "defmeth" and "deffunc" we now have a symmetrical 
definition syntax!

deffunc bar():
   return

defobj Foo():
defmeth __init__(self, blah):
pass

Extra Credit: Can anyone think of a better solution for defining objects 
without using keywords at all? Hmm... I'm getting a chubby just thinking about 
it!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyWart (Terminolgy): "Class"

2013-01-13 Thread Chris Angelico
On Mon, Jan 14, 2013 at 6:32 PM, Rick Johnson
 wrote:
> I really don't like using two words ("define object", or "def obj") and using 
> one single keyword is ambiguous ("object" or "obj"). So the obvious solution 
> is to combine the abbreviated words into one compound keyword that will save 
> keystrokes, save parsing, and all-the-while maintain symmetry. That keyword 
> is "defobj". Coupled with "defmeth" and "deffunc" we now have a symmetrical 
> definition syntax!
>
> deffunc bar():
>return
>
> defobj Foo():
> defmeth __init__(self, blah):
> pass

Awesome! Now, just one more step to make Python into the World's Most
Awesome Language(tm): Replace those lengthy words with single symbols
found in the Unicode set; compress everything down and enforce perfect
Unicode handling. Also, demand that names be one character long, to
enforce creativity by the Mark Rosewater principle. We will then have
a truly wonderful language; everything will be so utterly readable.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list