Re: what is wrong with this script and how do I get the value in a php script

2014-10-12 Thread Peter Pearson
On Sun, 12 Oct 2014 07:24:52 -0700 (PDT), martijnperd...@gmail.com wrote: > what is wrong with this script and how do I get the value Rij1 and > Rij2 and Rij3 and Rij4 and Rij5 and Rij6 in a php script > > import RPi.GPIO as GPIO > GPIO.setmode(GPIO.BCM) > > GPIO.setup(17, GPIO.IN) > GPIO.setup(18

Re: 2d color-bar map plot

2014-10-17 Thread Peter Pearson
On Fri, 17 Oct 2014 14:28:13 +0800, Dhananjay wrote: [snip] > xs = ys = zs = [] > for line in fl1: > line = line.split() > xs.append(float(line[0])) > ys.append(float(line[1])) > zs.append(float(line[2])) > > print xs[0], ys[0], zs[0] The line "xs = ys = zs = []" is almost surely n

Matplotlib: getting a figure to show without plt.show()

2014-10-21 Thread Peter Pearson
I'm using Matplotlib to present a "control" window with clickable buttons, and to plot things in another window when you click buttons, in the style of the code below. I'm ashamed of the stinky way I use "first" to call plt.show the first time data are plotted but then to call fig.canvas.draw for

Re: how to make a nested list

2011-09-15 Thread Peter Pearson
On Thu, 15 Sep 2011 18:57:24 +0200, Stef Mientki wrote: [snip] > Because the list is much larger, I need a shortcut (ok I can use a for loop) > So I tried > >>> B = 3 * [ [ None, None ]] > >>> B[2][0] = 77 > >>> B > [[77, None], [77, None], [77, None]] > > which doesn't work as expected. > > any su

Re: Operator commutativity

2011-09-20 Thread Peter Pearson
On Mon, 19 Sep 2011 05:48:07 -0700, Ethan Furman wrote: [snip] > Also, if the right-hand operand is a subclass of the left-hand operand > then Python will try right-hand_operand.__radd__ first. I don't think it works that way for me: Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) >>> class C

Re: Graphing

2011-09-21 Thread Peter Pearson
On Wed, 21 Sep 2011 08:44:13 -0700, Frank Ruiz wrote: > I am looking to plot some data points related to system metrics. > Benchmarking, etc. Can someone give some recommendations on a good way > to graph these datapoints in python. I started looking into > matplotlib, however was interested in ot

Re: Environment variables not visible from Python

2011-09-22 Thread Peter Pearson
On Thu, 22 Sep 2011 09:21:59 +0200, Thomas Rachel wrote: [snip] > $ python -c 'import os; print "\n".join(sorted("%s=%s" % (k,v) for k,v > in os.environ.iteritems()))' | diff -u - <(env|LANG=C sort) [standing ovation] -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.py

Re: __dict__ attribute for built-in types

2011-10-28 Thread Peter Pearson
On Fri, 28 Oct 2011 00:52:40 +0200, candide wrote: [snip] > hasattr(42, '__dict__') >> False [snip] > > Let'have a try : > > >>> hasattr(43, '__dict__') > False > >>> > > so we have proved by induction that no integer instance has a > dictionnary attribute ;) You left out an important step i

Re: Confusing math problem

2013-02-21 Thread Peter Pearson
On Fri, 22 Feb 2013 08:23:27 +1100, Chris Angelico wrote: > On Fri, Feb 22, 2013 at 7:49 AM, Dave Angel wrote: >> However, if I do: >> >> print 3**60, "\n", int(math.pow(3,60)), "\n", pow(3,60) >> >> >> I get: >> >> 42391158275216203514294433201 >> 42391158275216203520420085760 >> 423911582752162

Re: Python Newbie

2013-02-21 Thread Peter Pearson
On Thu, 21 Feb 2013 13:26:41 -0800 (PST), Piterrr wrote: > I am a long time C sharp dev, just learning Python now due > to job requirements. My initial impression is that Python > has got to be the most ambiguous and vague language I have > seen to date. I have major issues with the fact that whit

Re: Vowels [was Re: "monty" < "python"]

2013-03-21 Thread Peter Pearson
On Thu, 21 Mar 2013 21:09:52 +1100, Chris Angelico wrote: > On Thu, Mar 21, 2013 at 8:36 PM, David H Wild wrote: >> In article , Larry Hudson >> wrote: >>> The word "apron" was originally "napron", and over the years the phrase >>> "a napron" mutated to "an apron". So that became the accepted w

Re: Trying to understand working with dicts

2013-04-05 Thread Peter Pearson
On Fri, 5 Apr 2013 18:04:03 +0530, inshu chauhan wrote: > --089e0111cf5068b65204d99c4d46 > Content-Type: text/plain; charset=ISO-8859-1 [snip] > Here in my part of the code where cc is a dictionary. I want to understand > what actually cc.iterkeys() and cc[k] actually doing. > I am already reading

ossaudiodev problem: sawtooth noise

2009-01-20 Thread Peter Pearson
The following code uses ossaudiodev to read 1000 values from my sound card at a rate of 12,000 samples per second: *** begin code *** import ossaudiodev as o import struct d = o.open( "r" ) _, _, _ = d.setparameters( o.AFMT_S16_LE, 1, # channels

Re: is this pythonic?

2009-01-21 Thread Peter Pearson
On Wed, 21 Jan 2009 16:16:32 +0100, TP wrote: > > Is the following code pythonic: > l=[{"title":"to", "value":2},{"title":"ti","value":"coucou"}] dict = [ dict for dict in l if dict['title']=='ti'] l.remove(*dict) l > [{'title': 'to', 'value': 2}] > > Precision: I have stored da

Re: ossaudiodev problem: sawtooth noise

2009-01-23 Thread Peter Pearson
On Thu, 22 Jan 2009 20:58:14 -0200, Gabriel Genellina wrote: > En Mon, 19 Jan 2009 21:57:04 -0200, Peter Pearson > escribió: > >> The following code uses ossaudiodev to read 1000 values from >> my sound card at a rate of 12,000 samples per second: >> >> When I s

Re: ossaudiodev problem: sawtooth noise

2009-01-24 Thread Peter Pearson
On Fri, 23 Jan 2009 14:55:36 -0200, Gabriel Genellina wrote: > En Fri, 23 Jan 2009 14:36:46 -0200, Peter Pearson > escribió: >> On Thu, 22 Jan 2009 20:58:14 -0200, Gabriel Genellina wrote: >>> En Mon, 19 Jan 2009 21:57:04 -0200, Peter Pearson >>> escribió: &g

Re: Securing a database

2009-01-25 Thread Peter Pearson
On Fri, 23 Jan 2009 06:10:31 -0800 (PST), kt83...@gmail.com wrote: > On Jan 23, 4:41 pm, Bryan Olson wrote: [snip] >> Look up DRM technology companies, such as CloakWare, Macrovision, and >> Cryptography Research. >> >> If you have a modest number of customers, hardware solutions and/or >> strict

Re: nth root

2009-02-01 Thread Peter Pearson
On Sun, 1 Feb 2009 15:36:43 +1000, Tim Roberts wrote: > > Actually, all I'm interested in is whether the 100 digit > numbers have an exact integral root, or not. At the > moment, because of accuracy concerns, I'm doing something > like > > for root in powersp: >

Re: Membership of multiple items to a list

2009-02-02 Thread Peter Pearson
Sorry to whine, but here's how this looks on slrn: On Mon, 2 Feb 2009 00:24:19 -0800 (PST), Stephen Hansen wrote: > This is an OpenPGP/MIME signed message (RFC 2440 and 3156) > ---firegpg072eqfqovlg25y5x7pu7mz3 > Content-Type: text/plain; format=flowed; charset=UTF-8 > Content-Transfer-Encodin

Re: noob needs help

2008-11-30 Thread Peter Pearson
On Sun, 30 Nov 2008 09:50:32 -0800 (PST), toveysnake wrote: [snip] > I used kate to create this program and save it as > helloworld.py. I then entered the command python > helloworld.py into the terminal(I am using ubuntu 8.10) > and I get this error: > > [EMAIL PROTECTED]:~$ python helloworld.py >

Re: RELEASED Python 3.0 final

2008-12-05 Thread Peter Pearson
On Thu, 4 Dec 2008 15:49:46 -0600, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > It's more than warnings. With properly crafted > combinations of spaces and tabs you can get code which > looks like it has a certain indentation to the human > observer but which looks like it has different indent

Re: how to get a beep, OS independent ?

2008-12-07 Thread Peter Pearson
On Sun, 07 Dec 2008 00:40:53 +0100, Stef Mientki wrote: > > I want to give a small beep, > for windows there's message-beep, > and there seems to be something like " curses" , > but that package seems to be totally broken in P2.5 for windows. > > Any other suggestions ? Many people have suggested

Re: [OT] Google Groups in bad odour

2008-12-10 Thread Peter Pearson
On Wed, 10 Dec 2008 02:20:24 -0800 (PST), Frank Millman wrote: > . . . I will therefore have to find a suitable news client. Any > recommendations? I'm a happy user of slrn. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list

Re: gif creator

2008-10-07 Thread Peter Pearson
On Mon, 6 Oct 2008 08:18:14 -0700 (PDT), [EMAIL PROTECTED] wrote: > has anyone written a gif creator program purely in python that doesn't > require PIL or tons of other claptrap? If you would be interested in an old and simpleminded Python program for manipulating PNM files, contact me by email.

Re: Making class attributes non-case-sensitive?

2008-10-13 Thread Peter Pearson
On Mon, 13 Oct 2008 04:08:03 -0700 (PDT), Rafe <[EMAIL PROTECTED]> wrote: > Just so I don't hijack my own thread, the issue is 'how to wrap an > object which is not case sensitive'. > > The reason I am stuck dealing with this?... The application's API is > accessed through COM, [snip] > XSI allows

Re: Can Python fix vcard files?

2008-10-14 Thread Peter Pearson
On Tue, 14 Oct 2008 03:23:37 +0200, Dotan Cohen <[EMAIL PROTECTED]> wrote: > 2008/10/14 <[EMAIL PROTECTED]>: >> >>Dotan> Can Python go through a directory of files and replace each >>Dotan> instance of "newline-space" with nothing? >> >> Sure. Something like (*completely* untested, so cav

Re: Ordering python sets

2008-10-22 Thread Peter Pearson
On Wed, 22 Oct 2008 15:37:03 +0200, Peter Otten <[EMAIL PROTECTED]> wrote: > Tim Chase wrote: > >> Though for each test, in 2.3, 2.4, and 2.5 that I've got >> installed on my local machine, they each printed "s" in-order, >> and the iteration occurred in-order as well, even without the >> added "so

Re: dictionary

2008-10-24 Thread Peter Pearson
On 24 Oct 2008 13:17:45 GMT, Steven D'Aprano wrote: > > What are programmers coming to these days? When I was their age, we were > expected to *read* the error messages our compilers gave us, not turn to > the Interwebs for help as soon there was the tiniest problem. Yes, and what's more, the te

Re: beutifulsoup

2008-10-29 Thread Peter Pearson
On Wed, 29 Oct 2008 09:45:31 -0700 (PDT), luca72 <[EMAIL PROTECTED]> wrote: > Hello > I try to use beautifulsoup > i have this: > sito = urllib.urlopen('http://www.prova.com/') > esamino = BeautifulSoup(sito) > luca = esamino.findAll('tr', align='center') > > print luca[0] > [The following long str

Re: help me~!!!'tuple' object has no attribute 'compile'

2008-11-12 Thread Peter Pearson
On Wed, 12 Nov 2008 02:07:46 -0800 (PST), [EMAIL PROTECTED] wrote: [snip] > > import urllib > import urllib2 > import re > import MySQLdb > > conn=MySQLdb.connect > (host="localhost",user="root",passwd="ylj",db="net", charset="utf8") > cur = conn.cursor() > sql='select > net_site.downline_re,net_si

Re: function parameter scope python 2.5.2

2008-11-21 Thread Peter Pearson
On Fri, 21 Nov 2008 10:12:08 -0500, J Kenneth King wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> >> I am curious why you thought that. What made you think Python should/did >> make a copy of weird_obj.words when you pass it to a function? [snip] > Of course if there is any further readin

Re: Problem with writing fast UDP server

2008-11-21 Thread Peter Pearson
On Fri, 21 Nov 2008 08:14:19 -0800 (PST), Krzysztof Retel wrote: > I am not sure what do you mean by CPU-bound? How can I find out if I > run it on CPU-bound? CPU-bound is the state in which performance is limited by the availability of processor cycles. On a Unix box, you might run the "top" uti

Re: Roulette wheel

2009-03-05 Thread Peter Pearson
On Thu, 05 Mar 2009 18:07:29 +0100, Peter Otten <__pete...@web.de> wrote: [snip] > > Just for fun here's an alternative version of your function > > def generate_crossover(pop, prob): > for a, b in zip(*[iter(pop)]*2): . . . Good grief! That's devilishly obscure. -- To email me, substitute

Re: Roulette wheel

2009-03-05 Thread Peter Pearson
On 05 Mar 2009 20:43:41 GMT, mattia wrote: >> for a, b in zip(*[iter(pop)]*2): > In the python documentation there is a similar example, well, the obscure > thing here is the usage of *[iter(pop)]! Then I believe that I can safely > say that you iterate over the values 0 and 1, 2 and 3 etc.

Parameter sublists [was: An ordering question]

2009-03-13 Thread Peter Pearson
On Fri, 13 Mar 2009 18:56:30 +0100, Hrvoje Niksic wrote: [snip] > a.sort(key=lambda (x, y): b[y - 1], reverse=True) Huh? I had no idea one could do this: >>> def g( ( ( x, y ), z ) ): ... return y ... >>> g( ((1,2),3) ) 2 What should I have read to learn that trick? -- To email me, substi

Re: How to add months to a date (datetime object)?

2009-03-16 Thread Peter Pearson
On Sun, 15 Mar 2009 16:27:01 -0400, Roy Smith wrote: > In article , > Chris Rebert wrote: > >> Besides your behavior, one could equally well argue that a 31st repeat >> on months without a 31st should just be dropped, or that it should >> carry over onto the 1st of the next month (ignoring the c

Re: script files with python (instead of tcsh/bash)?

2009-03-21 Thread Peter Pearson
On Sat, 21 Mar 2009 09:26:02 -0400, Esmail wrote: > > I am wondering if anyone is using python to write script files? If it can be done in a few simple lines of shell script, fine: make it a shell script. But if it's more complex than that, Python is clearer. Just my two cents. -- To email me,

Re: Beazley on Generators

2009-04-01 Thread Peter Pearson
On Wed, 01 Apr 2009 01:03:50 -0400, Terry Reedy wrote: > At PyCon2008, David Beazley presented an excellent talk on generators. > Generator Tricks for Systems Programmers > http://www.dabeaz.com/generators/index.html > > At PyCon2009, he followed up with another talk on more advanced > generator

Re: Hash of None varies per-machine

2009-04-04 Thread Peter Pearson
On 03 Apr 2009 10:57:05 -0700, Paul Rubin wrote: > ben.tay...@email.com writes: >> 1. Is it correct that if you hash two things that are not equal they >> might give you the same hash value? > > Yes, hashes are 32 bit numbers and there are far more than 2**32 > possible Python values (think of lon

Re: Computed attribute names

2009-04-09 Thread Peter Pearson
On Wed, 8 Apr 2009 19:47:46 +0100, Dale Amon wrote: [snip] > self.IBM029 = re.compile([^acharset] > self.IBM026 = re.compile([^anothercharset] Whoa! Thanks for the trip down memory lane. And a cheery IEFBR14 to you, too. -- To email me, substitute nowhere->spamcop, invalid->net. -- ht

Re: numpy.where

2009-04-09 Thread Peter Pearson
On Thu, 09 Apr 2009 09:09:18 -0400, Lou Pecora wrote: > > Thanks, Neil. Always something to learn. I've used Numpy for several > years, but still have not plumbed the depths. Just tried this script > and, yep, it works. > > arr=array([-1,1.0,2.2,-10.0,1.1, 0.9,-0.9]) > cond= arr <

Re: numpy.where

2009-04-10 Thread Peter Pearson
On Fri, 10 Apr 2009 02:39:46 -0500, Robert Kern wrote: > On 2009-04-09 22:40, Peter Pearson wrote: >> >> Hey, if you find TFM, please tell me where it is. I haven't >> found anything Fine. I even bought Travis Oliphant's book, >> which helps a little, bu

Re: any(), all() and empty iterable

2009-04-13 Thread Peter Pearson
On Sun, 12 Apr 2009 06:53:24 -0500, Tim Chase wrote: >>>From the docs: >> >> all(iterable) >> >> Return True if all elements of the iterable are true. Equivalent >> to: >> >> def all(iterable): >> for element in iterable: >> if

Re: script question

2009-04-17 Thread Peter Pearson
On 17 Apr 2009 07:03:18 -0700, Aahz wrote: > In article , Piet van Oostrum wrote: >> >>funclist = [func01, func02, func03, ... ] >>for i in range(1,n): >>funclist[i]() > > Go to all that trouble, you might as well make it easier: > > for func in funclist: > func() Yes. Especially because

Re: I'm sort of mystified by the print hex to char conversion

2009-04-18 Thread Peter Pearson
On Sat, 18 Apr 2009 11:45:09 -0700 (PDT), grocery_stocker wrote: > I'm just really not seeing how something like x63 and/or x61 gets > converted by 'print' to the corresponding chars in the following > output... > > [cdal...@localhost oakland]$ python > Python 2.4.3 (#1, Oct 1 2006, 18:00:19) > [G

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Peter Pearson
On 20 Apr 2009 09:26:34 GMT, Steven D'Aprano wrote: > On Mon, 20 Apr 2009 10:54:40 +0200, Gerhard Häring wrote: [snip] >> I prefer to write it explicitly: >> >> if len(lst) > 0: > > Do you also count the length of a list explicitly? > > n = 0 > for item in lst: > n += 1 > if n > 0: > ... >

Re: and [True,True] --> [True, True]?????

2009-04-21 Thread Peter Pearson
On 21 Apr 2009 03:06:40 GMT, Steven D'Aprano wrote: > On Mon, 20 Apr 2009 15:53:41 +0000, Peter Pearson wrote: > >> Like Gerhard, I prefer the construction that explicitly says, "This is a >> list, and this is what I'll do if it's not empty." To me, a

Re: How can I get Tkinter to work in Python? (I tried many things)

2009-04-28 Thread Peter Pearson
On Mon, 27 Apr 2009 17:49:26 -0700 (PDT), tom...@gmail.com wrote: [snip] > There are errors, but since there is many of them: > here is a cut out of the _tkinter errors: > > libpython2.6.a(_tkinter.o): In function `Tkapp_CallProc': > /home/tomzam/mylib6/Python-2.6.2/./Modules/_tkinter.c:1263: undef

Re: What do you think of ShowMeDo

2009-04-30 Thread Peter Pearson
On Wed, 29 Apr 2009 20:13:32 -0400, David Robinow wrote: > On Wed, Apr 29, 2009 at 9:29 AM, wrote: > ... >> To reiterate, I responded to this thread because I think Ben's posting >> gave an unfair impression of the site and i felt the need to address >> some misconceptions. I am sorry you failed

Re: What do you think of ShowMeDo

2009-05-01 Thread Peter Pearson
On Fri, 1 May 2009 07:53:35 +1000, Paul Hemans wrote: [snip] > them as they have been recorded in the anals of the web, however I .^ That's the second time in this thread. The first might have been deliberate gross wordplay, but now it's time for some

Re: problem with money datatype based calculations in python

2009-05-02 Thread Peter Pearson
On Sat, 02 May 2009 13:15:22 +0530, Krishnakant wrote: > hello all, > I am using postgresql as a database server for my db application. > > The database is related to accounts and point of sales and many > calculations involve money datatype. [snip] As far as I can tell, Python has no type "money

Re: Newcomer to Python tutorial question

2009-05-08 Thread Peter Pearson
On Fri, 8 May 2009 10:16:55 +0100, Alan Cameron wrote: [snip] > > In particular reference to the tutorial section > http://docs.python.org/3.0/tutorial/datastructures.html#nested-list-comprehensions > > There is a word which is ambiguous, at least to me. > > Perhaps you can explain the use of the

Re: What's the use of the else in try/except/else?

2009-05-12 Thread Peter Pearson
On 12 May 2009 09:35:36 GMT, Steven D'Aprano wrote: [snip] > To really be safe, that should become: > > try: > rsrc = get(resource) > except ResourceError: > log('no more resources available') > raise > else: > try: > do_something_with(rsrc) > finally: > rsrc.clo

Re: easiest way to plot x,y graphically during run-time?

2009-06-04 Thread Peter Pearson
On Thu, 04 Jun 2009 03:29:42 -0500, Nick Craig-Wood wrote: [snip] > Here is a demo with pygame... [snip] And just for completeness, here is a demo with PyGUI, written in similar style. (I'm a PyGUI newbie, so constructive criticism would be appreciated.) from GUI import Window, View, application

Re: Help needed in choosing an algorithm for Cryptographic services.

2008-05-30 Thread Peter Pearson
On Thu, 29 May 2008 20:27:35 -0500, Larry Bates wrote: > abhishek wrote: >> Hi group, recently my employer asked me too implement encryption/ >> decryption for secure data transfer over internet. Problem is that the >> client application is written using C# and the webserver where i need >> to stor

Re: catastrophic regexp, help!

2008-06-11 Thread Peter Pearson
On Tue, 10 Jun 2008 21:20:14 -0700 (PDT), cirfu <[EMAIL PROTECTED]> wrote: > pat = re.compile("(\w* *)*") > this matches all sentences. > if fed the string "are you crazy? i am" it will return "are you > crazy". > > i want to find a in a big string a sentence containing Zlatan > Ibrahimovic and som

Re: My fight with classes :)

2008-06-11 Thread Peter Pearson
On Wed, 11 Jun 2008 22:16:56 +0800, TheSaint <[EMAIL PROTECTED]> wrote: > Hi, > I'm very new with classes. I still reading something around ;) > > I got started to try a concatenation of 2 type of string, which have a > particular property to start with A or D. > > My class here: > """ Small cl

Re: print problem

2008-06-18 Thread Peter Pearson
On Tue, 17 Jun 2008 04:46:38 -0300, Gabriel Genellina wrote: > En Tue, 17 Jun 2008 04:10:41 -0300, Rich Healey escribió: >> Gabriel Genellina wrote: >>> En Tue, 17 Jun 2008 03:15:11 -0300, pirata <[EMAIL PROTECTED]> escribió: >>> I was trying to print a dot on console every second to indicates

Re: 32 bit or 64 bit?

2008-06-18 Thread Peter Pearson
On Tue, 17 Jun 2008 08:13:40 -0400, Phil Hobbs wrote: > [EMAIL PROTECTED] wrote: [snip] >> I have a physical system set up in which a body is supposed to >> accelerate and to get very close to lightspeed, while never really >> attaining it. After approx. 680 seconds, Python gets stuck and tells >>

Tkinter canvas drag/drop obstacle

2008-06-20 Thread Peter Pearson
Tkinter makes it very easy to drag jpeg images around on a canvas, but I would like to have a "target" change color when the cursor dragging an image passes over it. I seem to be blocked by the fact that the callbacks that might tell the target that the mouse has entered it (, , even ) aren't call

Re: Tkinter canvas drag/drop obstacle

2008-06-22 Thread Peter Pearson
On Fri, 20 Jun 2008 13:41:35 -0300, Guilherme Polo <[EMAIL PROTECTED]> wrote: > On Fri, Jun 20, 2008 at 1:11 PM, Peter Pearson <[EMAIL PROTECTED]> wrote: >> Tkinter makes it very easy to drag jpeg images around on a >> canvas, but I would like to have a "target&

Re: Freeze problem with Regular Expression

2008-06-26 Thread Peter Pearson
On 25 Jun 2008 15:20:04 GMT, Kirk <[EMAIL PROTECTED]> wrote: > Hi All, > the following regular expression matching seems to enter in a infinite > loop: > > > import re > text = ' MSX INTERNATIONAL HOLDINGS ITALIA srl (di seguito MSX ITALIA) > una ' > re.findall('[^A-Z|0-9]*((?:[0

Re: Freeze problem with Regular Expression

2008-06-26 Thread Peter Pearson
On Thu, 26 Jun 2008 11:20:01 -0500, Peter Pearson wrote: > On 25 Jun 2008 15:20:04 GMT, Kirk <[EMAIL PROTECTED]> wrote: [snip] >> the following regular expression matching seems to enter in a infinite >> loop: [snip] >> import re >> text = ' MSX INTERNATION

Re: Do I need "self" and "other"?

2008-06-28 Thread Peter Pearson
On Fri, 27 Jun 2008 20:19:00 -0400, Nick Dumas <[EMAIL PROTECTED]> wrote: [snip] > > Example: > > class Foo(): > self.x = 5 Have you tried what you're posting? Python 2.4.3 (#2, Oct 6 2006, 07:52:30) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "lic

Re: wrong md5 checksum

2008-07-01 Thread Peter Pearson
On Tue, 01 Jul 2008 17:54:05 +0200, kkwweett <[EMAIL PROTECTED]> wrote: > kkwweett a écrit : >> Hi, >> >> the download page (http://www.python.org/download/releases/3.0/) for >> Python 3000 shows : >> >> 9119625244b17aa35ed94b655a2b2135 13491200 python-3.0b1.msi >> >> but I got >> >> 9119625

Re: re.search much slower then grep on some regular expressions

2008-07-04 Thread Peter Pearson
On Fri, 4 Jul 2008 20:34:03 -0700 (PDT), Carl Banks wrote: > On Jul 4, 4:43 pm, "Filipe Fernandes" <[EMAIL PROTECTED]> wrote: >> On Fri, Jul 4, 2008 at 8:36 AM, Peter Otten <[EMAIL PROTECTED]> wrote: >> > Henning_Thornblad wrote: >> >> >> This script takes about 5 min to run on my computer: >> >> #

Re: interpretation of special characters in Python

2008-07-06 Thread Peter Pearson
On Sun, 06 Jul 2008 23:42:26 +0200, TP <[EMAIL PROTECTED]> wrote: > > $ python -c "print '\033[30;44m foo \033[0m'" [writes an escape sequence to stdout] > $ echo -e $esc$ColorBlackOnDarkblue foo $esc$ColorReset [also writes an escape sequence to stdout] > $ echo -n $esc$ColorBlackOnDarkblue foo

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Peter Pearson
On Mon, 7 Jul 2008 05:41:22 -0700 (PDT), mcl <[EMAIL PROTECTED]> wrote: [snip] > My use of classes is because I want two classes one for global > variables and one for global functions. One of the many lovely things about programming in the Python style is that very few things need to be global.

Re: interpretation of special characters in Python

2008-07-07 Thread Peter Pearson
On Mon, 07 Jul 2008 10:05:56 +0200, TP <[EMAIL PROTECTED]> wrote: > TP wrote: > >> So, the python print command *can* interpret these 4-character as a single >> character. It would be odd if there were no possibility to do the same >> thing when the characters are (i) stored in a python variable >

Re: bad recursion, still works

2008-07-16 Thread Peter Pearson
On Wed, 16 Jul 2008 15:20:23 +0200, Fredrik Lundh wrote: [snip] > Hope this helps more than it confuses. Absolutely. It is wonderfully enlightening. Many thanks. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list

Getting started with pyvtk

2008-05-01 Thread Peter Pearson
I'm trying to get started with pyvtk, the Python interface to the Visualization Toolkit, but there's obviously something important that I haven't figured out after an embarrassingly long morning of googling around. When I run sample pyvtk code (example1.py, from http://cens.ioc.ee/cgi-bin/viewcvs.

Re: Getting started with pyvtk

2008-05-02 Thread Peter Pearson
On Thu, 01 May 2008 16:45:51 -0500, Robert Kern <[EMAIL PROTECTED]> wrote: > > pyvtk is not the Python interface to VTK. It is for the > creation of VTK files. The vtk(1) command is a Tcl shell > with the VTK libraries loaded (I believe). Read the VTK > documentation for information on the Tcl in

Re: Getting started with pyvtk

2008-05-03 Thread Peter Pearson
On Fri, 02 May 2008 17:40:02 +0200, Paul Melis wrote: > > I'm not sure you've been helped so far as you seem to already understand > about pyvtk not being the official VTK bindings :) > > So, what would you like to know? Thanks, I think I'm set. For the benefit of the next instance of me googlin

Re: semantics of the |= operator

2008-08-22 Thread Peter Pearson
On Fri, 22 Aug 2008 00:35:31 -0700 (PDT), akva <[EMAIL PROTECTED]> wrote: > > well, frankly I expected a |= b to mean exactly the same as a = a | b > regardless of the object type. So did I. I'm glad your post called this to my attention; I recently told my kid exactly that wrong thing. -- To

Re: Numeric literal syntax (was: Py 2.6 changes)

2008-09-02 Thread Peter Pearson
On 02 Sep 2008 06:10:51 GMT, Steven D'Aprano wrote: > At the risk of bike-shedding, [snip] (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the wonderful C. Northcote Parkinson, but how many readers will catch the allusion? -- To email me, s

Re: Numeric literal syntax

2008-09-02 Thread Peter Pearson
On Tue, 02 Sep 2008 17:18:58 GMT, Alan G Isaac <[EMAIL PROTECTED]> wrote: >> On 02 Sep 2008 06:10:51 GMT, Steven D'Aprano wrote: >>> At the risk of bike-shedding, >> [snip] > > Peter Pearson wrote: >> (startled noises) It is a delight to find a refer

Re: Extract Information from Tables in html

2008-09-05 Thread Peter Pearson
On Fri, 5 Sep 2008 11:35:14 -0300, Walter Cruz <[EMAIL PROTECTED]> wrote: > On Fri, Sep 5, 2008 at 11:29 AM, Jackie Wang <[EMAIL PROTECTED]> wrote: >> Here is a html code: >> >> >> >> Premier Community Bank of Southwest Florida >> >> Fort Myers, FL >> >> >> >> My question

Re: Problem occured while sending mail

2008-09-17 Thread Peter Pearson
On Wed, 17 Sep 2008 05:28:05 -0700 (PDT), sui <[EMAIL PROTECTED]> wrote: > On Sep 17, 5:04 pm, sui <[EMAIL PROTECTED]> wrote: >> this is my code >> >> import sys, os, glob, datetime, time >> import smtplib >> ## Parameters for SMTP session >> port=587 >> SMTPserver= 'smtp.gmail.com' >> SMTPuser= '

Re: Problem occured while sending mail

2008-09-18 Thread Peter Pearson
On Wed, 17 Sep 2008 23:53:36 -0700 (PDT), sui <[EMAIL PROTECTED]> wrote: > On Sep 17, 8:04 pm, Peter Pearson <[EMAIL PROTECTED]> wrote: >> On Wed, 17 Sep 2008 05:28:05 -0700 (PDT), sui <[EMAIL PROTECTED]> wrote: [snip] >> > socket.error: (110, 'Con

Re: Python newbie

2008-09-19 Thread Peter Pearson
On 19 Sep 2008 08:13:05 GMT, Steven D'Aprano wrote: > On Fri, 19 Sep 2008 09:13:48 +0200, Mladen Gogala wrote: [snip] >> perl -e '@a=(1,2,3); map { $_*=2 } @a; map { print "$_\n"; } @a;' >> >> The equivalent in Python looks like this: > > Actually, no it doesn't. The equivalent looks more like th

Re: BeautifulSoup and Problem Tables

2008-09-21 Thread Peter Pearson
On Sat, 20 Sep 2008 20:51:52 -0700 (PDT), [EMAIL PROTECTED] wrote: [snip] > from BeautifulSoup import BeautifulSoup > bst=file(r"c:\bstest.htm").read() > soup=BeautifulSoup(bst) > rows=soup.findAll('tr') > len(rows) > a=len(rows[0].findAll('td')) > b=len(rows[1].findAll('td')) > c=len(rows[2].findA

Re: understanding list scope

2008-09-21 Thread Peter Pearson
On Sun, 21 Sep 2008 06:17:36 -0700 (PDT), Alex wrote: > On 21 Set, 15:07, George Sakkis <[EMAIL PROTECTED]> wrote: >> On Sep 21, 8:51 am, Alex <[EMAIL PROTECTED]> wrote: [snip] >> > I have a problem understanding the behaviour of this snippet: [snip] >> Because you're doing a shallow copy: >> http:

Re: Docstrings for class attributes

2008-09-23 Thread Peter Pearson
On Tue, 23 Sep 2008 15:23:35 +1000, Tom Harris <[EMAIL PROTECTED]> wrote: > > I want to have a class as a container for a bunch of symbolic names > for integers, eg: > > class Constants: > FOO = 1 > BAR = 2 > > Except that I would like to attach a docstring text to the constants, > so that

Re: Python arrays and sting formatting options

2008-09-30 Thread Peter Pearson
On Tue, 30 Sep 2008 00:04:18 +0200, Ivan Rebori wrote: > > 1. Multi dimensional arrays - how do you load them in python > For example, if I had: > --- > 1 2 3 > 4 5 6 > 7 8 9 > > 10 11 12 > 13 14 15 > 16 17 18 > --- > with "i" being the row number, "j" the column number, and "k" the .. > uh

Re: IndentationError

2009-12-10 Thread Peter Pearson
On Fri, 11 Dec 2009 12:57:15 +1100, Lie Ryan wrote: > On 12/10/2009 6:32 AM, hong zhang wrote: >> List, >> >> I got error says IndentationError in end of line. >> I could not figure out why. See following: >> >> $ ./cont-mcs >>File "./cont-mcs", line 264 >> mcs1 = ht_val+cck_val+green_val

Re: numpy performance and random numbers

2009-12-20 Thread Peter Pearson
On Sun, 20 Dec 2009 07:26:03 +1100, Lie Ryan wrote: > On 12/20/2009 4:02 AM, Carl Johan Rehn wrote: > > Parallel PRNGs are an unsolved problem in computer science. >> >> Thanks again for sharing your knowledge. I had no idea. This means >> that if I want to speed up my application I have to go

Re: numpy performance and random numbers

2009-12-23 Thread Peter Pearson
On Sun, 20 Dec 2009 21:02:02 -0800, Rami Chowdhury wrote: > > On Dec 20, 2009, at 17:41 , Peter Pearson wrote: > >> Why not use a good cipher, such as AES, to generate a pseudorandom >> bit stream by encrypting successive integers? > > Isn't the Fortuna PRNG based

Re: ISO module for binomial coefficients, etc.

2010-01-27 Thread Peter Pearson
On Sun, 24 Jan 2010 16:11:03 -0500, Dave Angel wrote: > I didn't think of simply summing the logs. A couple terms of Stirling's approximation work pretty well: def log_fact_half( N ): """log_fact_half( n ) returns the natural logarithm of the factorial of n/2. n need not be an integer. D

Re: setting variables in the local namespace

2009-10-13 Thread Peter Pearson
On Tue, 13 Oct 2009 17:05:03 +0100, Chris Withers wrote: [snip] > - what is so wrong with wanting to set a variable in the local namespace > based on a name stored in a variable? I'm not sure it's "so wrong" that one should never, ever do it, but it *does* blur the boundary between the program an

Spam reported

2009-10-20 Thread Peter Pearson
Spam reported to Google. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list

Spam reported

2009-10-20 Thread Peter Pearson
Reported. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list

Spam reported

2009-10-20 Thread Peter Pearson
Reported. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list

Re: Spam reported

2009-10-21 Thread Peter Pearson
On Wed, 21 Oct 2009 09:06:50 +1100, Ben Finney wrote: > Grant Edwards writes: >> On 2009-10-20, Peter Pearson wrote: >> >> > Reported to Google's groups-abuse. >> >> What are these postings supposed to mean? > > That the posting which started the t

Re: Help with code = Extract numerical value to variable

2009-10-22 Thread Peter Pearson
On Thu, 22 Oct 2009 10:27:57 -0700 (PDT), Steve wrote: > I have some data that I'm performing some analysis on. > How do I grab the numerical value if it's present and ignore > otherwise. So in the following example > I would have assign the following values to my var > 16 > 20 > 2 > 7 > 0 > > > In

Re: Beautifulsoup code that is not running

2009-11-18 Thread Peter Pearson
On Tue, 17 Nov 2009 14:38:55 -0800 (PST), Zeynel wrote: [snip] from BeautifulSoup import BeautifulSoup > soup = BeautifulSoup (file("test.html").read()) title = soup.find('title') titleString = title.string open('extract.text', 'w').write(titleString) > > This runs without

Re: Traversing through variable-sized lists

2010-02-17 Thread Peter Pearson
On Wed, 17 Feb 2010 10:10:37 -0800 (PST), Andrej Mitrovic wrote: [snip] > _num_frames = 32 > _frames = range(0, _num_frames) # This is a list of actual objects, > I'm just pseudocoding here. > _values = [0, 1, 2, 3, 4] > > I want to call a function of _frames for each frame with a _values > argumen

Re: Is this secure?

2010-02-26 Thread Peter Pearson
On Wed, 24 Feb 2010 20:16:24 +0100, mk wrote: > On 2010-02-24 20:01, Robert Kern wrote: >> I will repeat my advice to just use random.SystemRandom.choice() instead >> of trying to interpret the bytes from /dev/urandom directly. > > Out of curiosity: > > def gen_rand_string(length): > prng = r

Re: Is this secure?

2010-02-26 Thread Peter Pearson
On Wed, 24 Feb 2010 21:02:07 +0100, mk wrote: [snip] > > rand_str_SystemRandom_seeding > mean 3845.15384615 std dev 46.2016419186 > l 3926 1.75 std devs away from mean > y 3916 1.53 std devs away from mean > d 3909 1.38 std devs away from mean > a 3898 1.14 std devs away from mean > p 3898 1.14 st

Re: what's the precision of fractions.Fraction?

2010-11-19 Thread Peter Pearson
On Fri, 19 Nov 2010 07:29:59 -0800 (PST), RJB wrote: > Does Fractions remove common factors the way it should? > > If it does and you want to find the closest fraction with a smaller > denominator i think tou'll need some number theory and continued > fractions. No heroics required, finding the g

Re: inverse of a matrix with Fraction entries

2010-11-24 Thread Peter Pearson
On Wed, 24 Nov 2010 14:02:21 +0100, Daniel Fetchinson wrote: [snip] > I'm using fractions.Fraction as entries in a matrix because I need to > have very high precision and fractions.Fraction provides infinite > precision . . . [snip] > > Probably it doesn't matter but the matrix has all components n

<    1   2   3   4   >