Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
After a bit of reading, I've decided to use Beautiful Soup 4, with lxml as the parser. I considered simply using lxml to do all the work, but I just got lost in the documentation and tutorials. I couldn't find a clear explanation of how to parse an HTML file and then navigate its structure. The Be

Re: help: confused about python flavors....

2012-03-06 Thread Steven D'Aprano
On Tue, 06 Mar 2012 20:06:37 -0800, amar Singh wrote: > Hi, > > I am confused between plain python, numpy, scipy, pylab, matplotlib. Python is a programming language. It comes standard with many libraries for doing basic mathematics, web access, email, etc. Numpy is a library for doing scienti

help: confused about python flavors....

2012-03-06 Thread amar Singh
Hi, I am confused between plain python, numpy, scipy, pylab, matplotlib. I have high familiarity with matlab, but the computer I use does not have it. So moving to python. What should I use? and the best way to use it. I will be running matlab-like scripts sometimes on the shell prompt and someti

Get tkinter text to the clipboard

2012-03-06 Thread bugzilla-mail-box
How can I get something from tkinter gui to another program ? tkinter on python 3.2 on kde4 -- http://mail.python.org/mailman/listinfo/python-list

Re: are int, float, long, double, side-effects of computer engineering?

2012-03-06 Thread rusi
On Mar 6, 6:11 am, Xah Lee wrote: > some additional info i thought is relevant. > > are int, float, long, double, side-effects of computer engineering? It is a bit naive for computer scientists to club integers and reals as mathematicians do given that for real numbers, even equality is undecidab

Tools for refactoring/obfuscation

2012-03-06 Thread Javier
I am looking for an automated tool for refactoring/obfuscation. Something that changes names of functions, variables, or which would merge all the functions of various modules in a single module. The closest I have seen is http://bicyclerepair.sourceforge.net/ Does somebody know of something that

Why this recursive import fails?

2012-03-06 Thread INADA Naoki
I have 4 py files like below. Two __init__.py is empty file. $ find foo -name "*.py" foo/lib/lib.py foo/lib/__init__.py foo/__init__.py foo/foo.py $ cat foo/lib/lib.py from __future__ import absolute_import print('lib.py', __name__) from .. import foo #import foo.foo $ cat foo/foo.py from __futu

Re: What's the best way to write this regular expression?

2012-03-06 Thread Roy Smith
In article <12783654.1174.1331073814011.JavaMail.geo-discussion-forums@yner4>, John Salerno wrote: > I sort of have to work with what the website gives me (as you'll see below), > but today I encountered an exception to my RE. Let me just give all the > specific information first. The point o

Re: What's the best way to write this regular expression?

2012-03-06 Thread Terry Reedy
On 3/6/2012 6:57 PM, John Salerno wrote: Also, you're still double-posting. Grr. I just reported it to Google, but I think if I start to frequent the newsgroup again I'll have to switch to Thunderbird, or perhaps I'll just try switching back to the old Google Groups interface. I think the issue

Re: What's the best way to write this regular expression?

2012-03-06 Thread Terry Reedy
On 3/6/2012 6:05 PM, John Salerno wrote: Anything that allows me NOT to use REs is welcome news, so I look forward to learning about something new! :) I should ask though...are there alternatives already bundled with Python that I could use? lxml is +- upward compatible with xml.etree in the

Re: are int, float, long, double, side-effects of computer engineering?

2012-03-06 Thread Westley Martínez
On Tue, Mar 06, 2012 at 04:29:10PM -0500, Calvin Kim wrote: > On 03/06/2012 01:34 AM, Xah Lee wrote: > >while what you said is true, but the problem is that 99.99% of > >programers do NOT know this. They do not know Mathematica. They've > >never seen a language with such feature. The concept is ali

Re: pickle/unpickle class which has changed

2012-03-06 Thread Gelonida N
Hi Peter, A related question. Is there anyhing like a built in signature which would help to detect, that one tries to unpickle an object whose byte code has changed? The idea is to distinguish old and new pickled data and start some 'migration code' fi required The only thing, that I thought

RE: What's the best way to write this regular expression?

2012-03-06 Thread Prasad, Ramit
> > > Also, you're still double-posting. > > Grr. I just reported it to Google, but I think if I start to frequent the > newsgroup again I'll have to switch to Thunderbird, or perhaps I'll just > try switching back to the old Google Groups interface. I think the issue is > the new interface. > >

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
> Also, you're still double-posting. Grr. I just reported it to Google, but I think if I start to frequent the newsgroup again I'll have to switch to Thunderbird, or perhaps I'll just try switching back to the old Google Groups interface. I think the issue is the new interface. Sorry. -- http

Re: What's the best way to write this regular expression?

2012-03-06 Thread Steven D'Aprano
On Tue, 06 Mar 2012 15:05:39 -0800, John Salerno wrote: >> Anything that allows me NOT to use REs is welcome news, so I look >> forward to learning about something new! :) > > I should ask though...are there alternatives already bundled with Python > that I could use? Now that you mention it, I r

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
Thanks. I'm thinking the choice might be between lxml and Beautiful Soup, but since BS uses lxml as a parser, I'm trying to figure out the difference between them. I don't necessarily need the simplest (html.parser), but I want to choose one that is simple enough yet powerful enough that I won't ha

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
On Tuesday, March 6, 2012 5:05:39 PM UTC-6, John Salerno wrote: > > Anything that allows me NOT to use REs is welcome news, so I look forward > > to learning about something new! :) > > I should ask though...are there alternatives already bundled with Python that > I could use? Now that you ment

Re: What's the best way to write this regular expression?

2012-03-06 Thread Ian Kelly
On Tue, Mar 6, 2012 at 4:05 PM, John Salerno wrote: >> Anything that allows me NOT to use REs is welcome news, so I look forward to >> learning about something new! :) > > I should ask though...are there alternatives already bundled with Python that > I could use? Now that you mention it, I reme

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
On Tuesday, March 6, 2012 5:05:39 PM UTC-6, John Salerno wrote: > > Anything that allows me NOT to use REs is welcome news, so I look forward > > to learning about something new! :) > > I should ask though...are there alternatives already bundled with Python that > I could use? Now that you ment

Re: are int, float, long, double, side-effects of computer engineering?

2012-03-06 Thread Calvin Kim
On 03/06/2012 01:34 AM, Xah Lee wrote: while what you said is true, but the problem is that 99.99% of programers do NOT know this. They do not know Mathematica. They've never seen a language with such feature. The concept is alien. This is what i'd like to point out and spread awareness. I can s

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
> Anything that allows me NOT to use REs is welcome news, so I look forward to > learning about something new! :) I should ask though...are there alternatives already bundled with Python that I could use? Now that you mention it, I remember something called HTMLParser (or something like that) a

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
On Tuesday, March 6, 2012 4:52:10 PM UTC-6, Chris Rebert wrote: > On Tue, Mar 6, 2012 at 2:43 PM, John Salerno wrote: > > I sort of have to work with what the website gives me (as you'll see > > below), but today I encountered an exception to my RE. Let me just give all > > the specific informat

Re: What's the best way to write this regular expression?

2012-03-06 Thread Chris Rebert
On Tue, Mar 6, 2012 at 2:43 PM, John Salerno wrote: > I sort of have to work with what the website gives me (as you'll see below), > but today I encountered an exception to my RE. Let me just give all the > specific information first. The point of my script is to go to the specified > URL and e

Re: pickle/unpickle class which has changed

2012-03-06 Thread Peter Otten
Neal Becker wrote: > Peter Otten wrote: > >> Steven D'Aprano wrote: >> >>> On Tue, 06 Mar 2012 07:34:34 -0500, Neal Becker wrote: >>> What happens if I pickle a class, and later unpickle it where the class now has added some new attributes? >>> >>> Why don't you try it? >>> >>> py>

Re: Help me with weird logging problem

2012-03-06 Thread J
On Tue, Mar 6, 2012 at 11:19, Vinay Sajip wrote: > On Mar 6, 4:09 pm, J wrote: >> >> Any idea what I'm doing wrong? > > Levels can be set on loggers as well as handlers, and you're only > setting levels on the handlers. The default level on the root logger > is WARNING. A logger checks its level

Re: pickle/unpickle class which has changed

2012-03-06 Thread Neal Becker
Peter Otten wrote: > Steven D'Aprano wrote: > >> On Tue, 06 Mar 2012 07:34:34 -0500, Neal Becker wrote: >> >>> What happens if I pickle a class, and later unpickle it where the class >>> now has added some new attributes? >> >> Why don't you try it? >> >> py> import pickle >> py> class C: >> .

Monthly Python Meeting in Madrid (Spain)

2012-03-06 Thread Jesus Cea
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Next Thursday, 8th March. - -- Jesus Cea Avion _/_/ _/_/_/_/_/_/ j...@jcea.es - http://www.jcea.es/ _/_/_/_/ _/_/_/_/ _/_/ jabber

Re: Help me with weird logging problem

2012-03-06 Thread Vinay Sajip
On Mar 6, 4:09 pm, J wrote: > > Any idea what I'm doing wrong? Levels can be set on loggers as well as handlers, and you're only setting levels on the handlers. The default level on the root logger is WARNING. A logger checks its level first, and only if the event passes that test will it be pass

Help me with weird logging problem

2012-03-06 Thread J
Hi, I'm trying to add a couple log handlers to a program. The end goal is to log things at INFO or above to console, and if a -v option is set to ALSO log everything at DEBUG or above to a file. However, while I DO get the log file created, and log messages are appearing there, Debug messages ar

python simple web server

2012-03-06 Thread queency jones
hello pythonist i'm developing using the simple / basic http server i got very bad performance regarding to request time . 9 sec for each request replay. i tried to test this with this: python -m SimpleHTTPServer 8080 but no better. any sugestions ? that i can use ? my final goal is to serv 5 pe

Re: pickle/unpickle class which has changed

2012-03-06 Thread Peter Otten
Steven D'Aprano wrote: > On Tue, 06 Mar 2012 07:34:34 -0500, Neal Becker wrote: > >> What happens if I pickle a class, and later unpickle it where the class >> now has added some new attributes? > > Why don't you try it? > > py> import pickle > py> class C: > ... a = 23 > ... > py> c = C()

Re: Error with co_filename when loading modules from zip file

2012-03-06 Thread Peter Otten
Bob Rossi wrote: > On Tue, Mar 06, 2012 at 02:38:50AM -0800, Vinay Sajip wrote: >> On Mar 6, 2:40 am, Bob Rossi wrote: >> >> > Darn it, this was reported in 2007 >> > http://bugs.python.org/issue1180193 >> > and it was mentioned the logging package was effected. >> > >> > Yikes. >> > >> >> I wi

Re: pickle/unpickle class which has changed

2012-03-06 Thread Steven D'Aprano
On Tue, 06 Mar 2012 07:34:34 -0500, Neal Becker wrote: > What happens if I pickle a class, and later unpickle it where the class > now has added some new attributes? Why don't you try it? py> import pickle py> class C: ... a = 23 ... py> c = C() py> pickled = pickle.dumps(c) py> C.b = 42 #

Re: pickle/unpickle class which has changed

2012-03-06 Thread Peter Otten
Neal Becker wrote: > What happens if I pickle a class, and later unpickle it where the class > now has added some new attributes? - If the added attributes' values are immutable, provide defaults as class attributes. - Implement an appropriate __setstate__() method. The easiest would be # unte

Re: are int, float, long, double, side-effects of computer engineering?

2012-03-06 Thread Roy Smith
[intentionally violating the followup-to header] In article <7ol5r.29957$zd5.14...@newsfe12.iad>, Chiron wrote: > On Mon, 05 Mar 2012 22:34:46 -0800, Xah Lee wrote: > > > while what you said is true, but the problem is that 99.99% of > > programers do NOT know this. They do not know Mathematic

Re: Error with co_filename when loading modules from zip file

2012-03-06 Thread Bob Rossi
On Tue, Mar 06, 2012 at 02:38:50AM -0800, Vinay Sajip wrote: > On Mar 6, 2:40 am, Bob Rossi wrote: > > > Darn it, this was reported in 2007 > >  http://bugs.python.org/issue1180193 > > and it was mentioned the logging package was effected. > > > > Yikes. > > > > I will think about this, but don'

a interesting Parallel Programing Problem: asciify-string

2012-03-06 Thread Xah Lee
here's a interesting problem that we are discussing at comp.lang.lisp. 〈Parallel Programing Problem: asciify-string〉 http://xahlee.org/comp/parallel_programing_exercise_asciify-string.html here's the plain text. Code example is emacs lisp, but the problem is general. for a bit python relevancy…

pickle/unpickle class which has changed

2012-03-06 Thread Neal Becker
What happens if I pickle a class, and later unpickle it where the class now has added some new attributes? -- http://mail.python.org/mailman/listinfo/python-list

Re: Error with co_filename when loading modules from zip file

2012-03-06 Thread Vinay Sajip
On Mar 6, 2:40 am, Bob Rossi wrote: > Darn it, this was reported in 2007 >  http://bugs.python.org/issue1180193 > and it was mentioned the logging package was effected. > > Yikes. > I will think about this, but don't expect any quick resolution :-( I think the right fix would be not in the loggi

Re: are int, float, long, double, side-effects of computer engineering?

2012-03-06 Thread Chiron
On Mon, 05 Mar 2012 22:34:46 -0800, Xah Lee wrote: > while what you said is true, but the problem is that 99.99% of > programers do NOT know this. They do not know Mathematica. They've never > seen a Could you please offer some evidence to support this claim? Most of the programmers I've ever r

Re: are int, float, long, double, side-effects of computer engineering?

2012-03-06 Thread Chiron
On Mon, 05 Mar 2012 17:11:09 -0800, Xah Lee wrote: Yes. Why do you ask? Is this not obvious? Was this a rhetorical question? -- A girl with a future avoids the man with a past. -- Evan Esar, "The Humor of Humor" -- http://mail.python.org/mailman/listinfo/python-list

Re: are int, float, long, double, side-effects of computer engineering?

2012-03-06 Thread Russ P.
On Mar 5, 10:34 pm, Xah Lee wrote: > On Mar 5, 9:26 pm, Tim Roberts wrote: > > > Xah Lee wrote: > > > >some additional info i thought is relevant. > > > >are int, float, long, double, side-effects of computer engineering? > > > Of course they are.  Such concepts violate the purity of a computer