Re: encoding hell - any chance of salvation ?

2011-03-08 Thread southof40
Thanks for both the suggestions. I haven't yet had time to try them out but will do so and report back. -- http://mail.python.org/mailman/listinfo/python-list

encoding hell - any chance of salvation ?

2011-03-07 Thread southof40
Hi - I've got some code which uses array (http://docs.python.org/ library/array.html) to store charcters read from a file (it's not my code it comes from here http://sourceforge.net/projects/pygold/) The read is done, in GrammarReader.py, like this ... def readString(self, maxsize = -1):

Re: Pick items from list with probability based upon property of list member ?

2010-06-21 Thread southof40
Thanks to everybody ... as usual on c.l.p I'm blown away by the knowledge and skills ! I've added some replies/clarifications to other posts but thanks again to you all. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pick items from list with probability based upon property of list member ?

2010-06-21 Thread southof40
Oh yes as several have pointed out there was a typo in my original question ... I can only blame 'toolongatscreenitis' ! -- http://mail.python.org/mailman/listinfo/python-list

Re: Pick items from list with probability based upon property of list member ?

2010-06-21 Thread southof40
On Jun 20, 10:53 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Sun, 20 Jun 2010 03:19:55 -0700, southof40 wrote: I have list of of N Vehicle objects - the only possible vehicles are cars, bikes, trucks. I want to select an object from the list with a probability

Re: Pick items from list with probability based upon property of list member ?

2010-06-21 Thread southof40
On Jun 20, 10:55 pm, Rob Williscroft r...@rtw.me.uk wrote: southof40 wrote in news:da3cc892-b6dd-4b37-a6e6- b606ef967...@t26g2000prt.googlegroups.com in gmane.comp.python.general: I have list of of N Vehicle objects - the only possible vehicles are cars, bikes, trucks. I want to select

Re: Pick items from list with probability based upon property of list member ?

2010-06-21 Thread southof40
On Jun 20, 11:27 pm, Mel mwil...@the-wire.com wrote: southof40 wrote: I have list of of N Vehicle objects - the only possible vehicles are cars, bikes, trucks. I want to select an object from the list with a probability of : cars 0.7, bikes 0.3, trucks 0.1. I've currently implemented

Re: Pick items from list with probability based upon property of list member ?

2010-06-21 Thread southof40
On Jun 20, 10:58 pm, Cameron Simpson c...@zip.com.au wrote: On 20Jun2010 12:44, Stefan Behnel stefan...@behnel.de wrote: | southof40, 20.06.2010 12:19: | I have list of of N Vehicle objects - the only possible vehicles are | cars, bikes, trucks. | | I want to select an object from the list

Pick items from list with probability based upon property of list member ?

2010-06-20 Thread southof40
I have list of of N Vehicle objects - the only possible vehicles are cars, bikes, trucks. I want to select an object from the list with a probability of : cars 0.7, bikes 0.3, trucks 0.1. I've currently implemented this by creating another list in which each car object from the original list