Anonymous Classes

2007-07-12 Thread Lachlan Gunn
Hello. I have a library (SQLObject) that stores data as class variables. I would like to set a class variable in a certain context, specific to a certain instance of an object. This would require some sort of anonymous class. I have attempted to use the following code to set the connection stri

PyCF_DONT_IMPLY_DEDENT

2007-07-12 Thread Kay Schluehr
I found this flag in codeop.py PyCF_DONT_IMPLY_DEDENT = 0x200 # Matches pythonrun.h It is apperantly a parser flag used in the PARSER_FLAGS define in pythonrun.c. Questions: what does it actually mean and why is this implementation detail exposed to Python code. I tried to change the va

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-12 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > If what you wonder about, and the theory mentioned by Clemmer and > detailed by the AQF, are both true, then this may help explain why some > programmers are fiercely innovative why other, equally intelligent ones, > prefer to stick with some plodding, in

Re: bool behavior in Python 3000?

2007-07-12 Thread Stargaming
Steven D'Aprano schrieb: > On Wed, 11 Jul 2007 08:04:33 +0200, Stargaming wrote: > > > >>No, I think Bjoern just wanted to point out that all those binary >>boolean operators already work *perfectly*. You just have to emphasize >>that you're doing boolean algebra there, using `bool()`. >>"Expl

Re: Anonymous Classes

2007-07-12 Thread Bruno Desthuilliers
Lachlan Gunn a écrit : > Hello. > > I have a library (SQLObject) that stores data as class variables. I would > like to set a class variable in a certain context, specific to a certain > instance of an object. This would require some sort of anonymous class. I > have attempted to use the follow

Re: Tuple vs List: Whats the difference?

2007-07-12 Thread Dave Baum
In article <[EMAIL PROTECTED]>, Shafik <[EMAIL PROTECTED]> wrote: > Hello folks, > > I am an experienced programmer, but very new to python (2 days). I > wanted to ask: what exactly is the difference between a tuple and a > list? I'm sure there are some, but I can't seem to find a situation > wh

Re: atexit, sys.exit, sys.exitfunc, reaching end of source code

2007-07-12 Thread [EMAIL PROTECTED]
On 12 jul, 01:32, Wojciech Mu a <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I am playing with theatexitmodule but I don't find a way to see the > > difference > > between a script calling sys.exit() and the interpreting > > arriving at the end > > of the source code file. This has a s

Re: Anonymous Classes

2007-07-12 Thread Lachlan Gunn
Thanks for your help. After trying your suggestion for a while, I eventually realised that SQLObject was doing something funny in its metaclass that was causing the issue, which I got around by mangling the class names with a counter. -- http://mail.python.org/mailman/listinfo/python-list

web page text extractor

2007-07-12 Thread kublai
Hello, For a project, I need to develop a corpus of online news stories. I'm looking for an application that, given the url of a web page, "copies" the rendered text of the web page (not the source HTNL text), opens a text editor (Notepad), and displays the copied text for the user to examine and

pytz giving incorrect offset and timezone

2007-07-12 Thread Sanjay
Hi All, Using pytz, I am facing a problem with Asia/Calcutta, described below. Asia/Calcutta is actually IST, which is GMT + 5:30. But while using pytz, it was recognized as HMT (GMT + 5:53). While I digged into the oslan database, I see the following: # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zon

Samodzielny program pod linuksem

2007-07-12 Thread stainboy
Witam. Zastanawiam się w jaki sposób mogę stworzyć samodzielny program pod linuksem napisany w pythonie, aby można go było uruchomić bez instalacji bibliotek pythona, chodzi mi o coś takiego jak py2exe pod Windowsa. Pozdrawiam JP -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-12 Thread Paul Rubin
Donn Cave <[EMAIL PROTECTED]> writes: > I've wondered if programmers might differ a lot in how much they > dread errors, or how they react to different kinds of errors. > For example, do you feel a pang of remorse when your program > dies with a traceback - I mean, what a horrible way to die? I'm

Re: Samodzielny program pod linuksem

2007-07-12 Thread Jarek Zgoda
stainboy napisał(a): > Witam. Zastanawiam się w jaki sposób mogę stworzyć samodzielny program > pod linuksem napisany w pythonie, aby można go było uruchomić bez > instalacji bibliotek pythona, chodzi mi o coś takiego jak py2exe pod > Windowsa. I think you tried to post on pl.comp.lang.python so

Re: Should I use Python for these programs?

2007-07-12 Thread Hendrik van Rooyen
"CC" <[EMAIL PROTECTED]> wrote: 8< --- > Basically, it's almost impossible to use > ethernet on other than PCs, on the official LAN. > > I will have to look into this further though, as higher data rate stuff > is a problem with serial.

Launch One Application From Another

2007-07-12 Thread Robert Rawlins - Think Blue
Hello Guys, I'm looking for the best method to launch one Python application from another? Is something like sub process going to be my best bet? Or is there something more specific for launching one python app from another? Thanks guys, Rob -- http://mail.python.org/mailman/listinfo/

Re: Try a different type of debugger.

2007-07-12 Thread Michael Newman
Thanks for making this terrific program. Can you add a setting for screen size? (perhaps desired Width and Height in pixels)? I have my screen set at 1024x768 (the web browser window is of course a little bit smaller) and I can't see all the program's rendering at the far right. -Mike On 7/11/07,

Re: 2**2**2**2**2 wrong? Bug?

2007-07-12 Thread Nick Craig-Wood
Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Wed, 11 Jul 2007 16:39:17 -0300, Paul McGuire <[EMAIL PROTECTED]> > escribió: > > > As was > > pointed out earlier, left-associativity with exponentiation is of > > little value, since (2**3)**2 is the same as 2**(3*2) or 2**6=64. > > Just fo

Re: os.wait() losing child?

2007-07-12 Thread Nick Craig-Wood
Jason Zheng <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood wrote: > > The problem you are having is you are letting Popen do half the job > > and doing the other half yourself. > > Except that I never wanted Popen to do any thread management for me to > begin with. Popen class has advertised its

variable naming query

2007-07-12 Thread loial
I'ma a newbie python user and would like clarification on variable naming conventions. What is the difference between self.myvariable self._myvariable self.__myvariable and when should I use each of them? -- http://mail.python.org/mailman/listinfo/python-list

Re: profiling a C++ python extension

2007-07-12 Thread [EMAIL PROTECTED]
Hi! It doesn't suffice to compile the python interpreter with -pg, as the module is loaded via dlopen. I solved the problem for my case compiling an executable with embedded python and the module itself. I would wish, that there would be an easier way. Best regards, Michael -- http://mail.python.

Re: variable naming query

2007-07-12 Thread Jean-Paul Calderone
On Thu, 12 Jul 2007 10:33:03 -, loial <[EMAIL PROTECTED]> wrote: >I'ma a newbie python user and would like clarification on variable >naming conventions. > >What is the difference between > >self.myvariable This is the convention for public attributes. >self._myvariable This is the conventio

Re: Rats! vararg assignments don't work

2007-07-12 Thread samwyse
On May 30, 7:29 am, Sion Arrowsmith <[EMAIL PROTECTED]> wrote: > samwyse <[EMAIL PROTECTED]> wrote: > >>samwysewrote: > >>>I thought that I'd try this: > >>> first, *rest = arglist > >>>Needless to say, it didn't work. > > [ ... ] > >My use-case is (roughtly) this: > > first, *rest = f.read

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-12 Thread Ben Finney
Paul Rubin writes: > The idea of designing languages with more and more support for > ensuring program correctness is to put the established, repetitive > processes into the computer where it belongs, freeing the programmer > to be innovative while still providing high a

Re: pytz giving incorrect offset and timezone

2007-07-12 Thread Simon Percivall
On Jul 12, 11:47 am, Sanjay <[EMAIL PROTECTED]> wrote: > Hi All, > > Using pytz, I am facing a problem with Asia/Calcutta, described below. > > Asia/Calcutta is actually IST, which is GMT + 5:30. But while using > pytz, it was recognized as HMT (GMT + 5:53). While I digged into the > oslan database

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-12 Thread Hendrik van Rooyen
"John Nagle" <[EMAIL PROTECTED]> wrote: > I've worked in big mainframe shops, where an operating system > crash caused everything to suddenly freeze, red lights came on all > over the building, and a klaxon sounded. I've worked for aerospace > companies, where one speaks of "defects", not "bu

Re: Tuple vs List: Whats the difference?

2007-07-12 Thread Hendrik van Rooyen
"Shafik" <[EMAIL PROTECTED]> wrote: > Hello folks, > > I am an experienced programmer, but very new to python (2 days). I > wanted to ask: what exactly is the difference between a tuple and a > list? I'm sure there are some, but I can't seem to find a situation > where I can use one but not the

Re: allow scripts to use .pth files?

2007-07-12 Thread samwyse
On Jul 8, 3:53 pm, John Machin <[EMAIL PROTECTED]> wrote: > I got the impression that the OP was suggesting that the interpreter > look in the directory in which it found the script. [...] > I got the impression that the problem was that the package was not > only not on sys.path but also not in t

Re: Portable general timestamp format, not 2038-limited

2007-07-12 Thread Ben Finney
Ilya Zakharevich <[EMAIL PROTECTED]> writes: > *This* was my question; and with kitchentop book, one cannot expect > to find such an answer. If interested, Wiki looks like a good place > to look it up. I don't know what Wiki[0] has to do with it, but just to check: http://c2.com/cgi/wiki?Wh

Re: Tuple vs List: Whats the difference?

2007-07-12 Thread Ben Finney
Dave Baum <[EMAIL PROTECTED]> writes: > In article <[EMAIL PROTECTED]>, > Shafik <[EMAIL PROTECTED]> wrote: > > > what exactly is the difference between a tuple and a list? I'm > > sure there are some, but I can't seem to find a situation where I > > can use one but not the other. > > Lists and t

Re: Re-raising exceptions with modified message

2007-07-12 Thread samwyse
On Jul 8, 8:50 am, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Did you run this? > With Py < 2.5 I get a syntax error, and with Py 2.5 I get: > > new.__class__ = old.__class__ > TypeError: __class__ must be set to a class > > -- Chris Damn, I'd have sworn I ran the final copy that I post

Re: allow scripts to use .pth files?

2007-07-12 Thread John Machin
On Jul 12, 9:55 pm, samwyse <[EMAIL PROTECTED]> wrote: > On Jul 8, 3:53 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > > > I got the impression that the OP was suggesting that the interpreter > > look in the directory in which it found the script. > [...] > > I got the impression that the problem

Re: allow scripts to use .pth files?

2007-07-12 Thread samwyse
On Jul 8, 3:53 pm, John Machin <[EMAIL PROTECTED]> wrote: > I'm curious whether you think that the OP's use of ".pth" was a typo, > and whether you have read this: >http://docs.python.org/lib/module-site.html I've read it, but not recently; the syntax of the .pyh files was in the back of my h

Re: allow scripts to use .pth files?

2007-07-12 Thread samwyse
On Jul 12, 7:20 am, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 12, 9:55 pm, samwyse <[EMAIL PROTECTED]> wrote: > > > On Jul 8, 3:53 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > > I got the impression that the OP was suggesting that the interpreter > > > look in the directory in which it fo

Re: bool behavior in Python 3000?

2007-07-12 Thread Nis Jørgensen
Alan Isaac skrev: > Since it is seemingly ignored in most of the comments > on this thread, I just want to remind that PEP 285 > http://www.python.org/dev/peps/pep-0285/ > says this: > > In an ideal world, bool might be better implemented as a > separate integer type that knows how to

Re: 2**2**2**2**2 wrong? Bug?

2007-07-12 Thread Ben Finney
"Gabriel Genellina" <[EMAIL PROTECTED]> writes: > "Which is the largest number that can be written with only 3 > digits?" Some people stop at 999, others try 99**9 and 9**99, and > the winner is 9**9**9 Since exponentiation is (I think?) the highest-order function we understand for writing *only

Re: variable naming query

2007-07-12 Thread Ben Finney
loial <[EMAIL PROTECTED]> writes: > What is the difference between > > self.myvariable Indicates to the reader that the attribute 'myvariable' is available for use as part of the interface of the object. Prefer this style unless you have good reason in a particular case to do otherwise. > self.

Re: bool behavior in Python 3000?

2007-07-12 Thread Ben Finney
"Terry Reedy" <[EMAIL PROTECTED]> writes: > In Guido's opinion (and mine, but his counts 100x), the positive > benefits of the current implementation are greater than the net > positive benefits of a 'pure' type. See > > http://www.python.org/dev/peps/pep-0285/ I assume you're referring to:

Re: Screen Scraping Question

2007-07-12 Thread jeffbg123
On Jul 11, 10:31 pm, Dan Stromberg - Datallegro <[EMAIL PROTECTED]> wrote: > On Wed, 11 Jul 2007 12:45:21 +, jeffbg123 wrote: > > Hey, > > > I am trying to make a bot for a flash game using python. However I am > > having some trouble with a screen scraping strategy. Is there an > > accepted wa

Re: New release: Crunchy 0.9

2007-07-12 Thread Paddy
On Jul 10, 12:37 am, André <[EMAIL PROTECTED]> wrote: > Crunchy 0.9 has been released. It is available > athttp://code.google.com/p/crunchy > > What is Crunchy? > > Crunchy is a an application that transforms html Python tutorials into > interactive session viewed within a browser. We are not aw

Re: os.wait() losing child?

2007-07-12 Thread Hrvoje Niksic
Nick Craig-Wood <[EMAIL PROTECTED]> writes: >> I think your polling way works; it seems there no other way around this >> problem other than polling or extending Popen class. > > I think polling is probably the right way of doing it... It requires the program to wake up every 0.1s to poll for

Re: os.wait() losing child?

2007-07-12 Thread Hrvoje Niksic
Jason Zheng <[EMAIL PROTECTED]> writes: > greg wrote: >> Jason Zheng wrote: >>> Hate to reply to my own thread, but this is the working program >>> that can demonstrate what I posted earlier: >> I've figured out what's going on. The Popen class has a >> __del__ method which does a non-blocking wai

Re: web page text extractor

2007-07-12 Thread Miki
Hello jk, > For a project, I need to develop a corpus of online news stories. I'm > looking for an application that, given the url of a web page, "copies" > the rendered text of the web page (not the source HTNL text), opens a > text editor (Notepad), and displays the copied text for the user to

Re: lists and dictionaries

2007-07-12 Thread Bart Ogryczak
On 11 jul, 21:08, Ladislav Andel <[EMAIL PROTECTED]> wrote: > Hi, > I have a list of dictionaries. > e.g. > [{'index': 0, 'transport': 'udp', 'service_domain': 'dp0.example.com'}, > {'index': 1, 'transport': 'udp', 'service_domain': 'dp1.example.com'}, > {'index': 0, 'transport': 'tcp', 'service_do

Re: Portable general timestamp format, not 2038-limited

2007-07-12 Thread Lew
Ben Finney wrote: > [0] Left unqualified, referring to a site named "Wiki" refers to *the* > Wiki, at http://c2.com/cgi/wiki>. If you mean some other > subsequent Wiki site, you'll need to be more specific. I'm betting they meant or one of its non-English

Re: web page text extractor

2007-07-12 Thread Andre Engels
2007/7/12, kublai <[EMAIL PROTECTED]>: > For a project, I need to develop a corpus of online news stories. I'm > looking for an application that, given the url of a web page, "copies" > the rendered text of the web page (not the source HTNL text), opens a > text editor (Notepad), and displays the

Re: web page text extractor

2007-07-12 Thread Andre Engels
2007/7/12, Andre Engels <[EMAIL PROTECTED]>: I forgot to include import urllib2, re here > def textonly(url): ># Get the HTML source on url and give only the main text >f = urllib2.urlopen(url) >text = f.read() >r = re.compile('\<[^\<\>]*\>') >newtext = r.sub('',text) >w

Re: lists and dictionaries

2007-07-12 Thread Bart Ogryczak
On 12 jul, 04:49, anethema <[EMAIL PROTECTED]> wrote: > > li = [ {'index': 0, 'transport': 'udp', 'service_domain': > > 'dp0.example.com'}, > > {'index': 1, 'transport': 'udp', 'service_domain': > > 'dp1.example.com'}, > > {'index': 0, 'transport': 'tcp', 'service_domain': > > 'dp0

Re: web page text extractor

2007-07-12 Thread Jon Rosebaugh
On 2007-07-12 04:42:25 -0500, kublai <[EMAIL PROTECTED]> said: > For a project, I need to develop a corpus of online news stories. I'm > looking for an application that, given the url of a web page, "copies" > the rendered text of the web page (not the source HTNL text), opens a > text editor (Not

Lists in classes

2007-07-12 Thread Jeremy Lynch
Hello, Learning python from a c++ background. Very confused about this: class jeremy: list=[] def additem(self): self.list.append("hi") return temp = jeremy() temp.additem() temp.additem() print temp.list temp2 = jeremy() prin

Re: Lists in classes

2007-07-12 Thread Bart Ogryczak
On 12 jul, 17:23, Jeremy Lynch <[EMAIL PROTECTED]> wrote: > Hello, > > Learning python from a c++ background. Very confused about this: > > > class jeremy: > list=[] > def additem(self): > self.list.append("hi") > return > > temp

Re: Lists in classes

2007-07-12 Thread kyosohma
On Jul 12, 10:23 am, Jeremy Lynch <[EMAIL PROTECTED]> wrote: > Hello, > > Learning python from a c++ background. Very confused about this: > > > class jeremy: > list=[] > def additem(self): > self.list.append("hi") > return > > t

Re: Lists in classes

2007-07-12 Thread Bart Ogryczak
On 12 jul, 17:23, Jeremy Lynch <[EMAIL PROTECTED]> wrote: > Hello, > > Learning python from a c++ background. Very confused about this: > > > class jeremy: > list=[] You've defined list (very bad choice of a name, BTW), as a class variable. To declare is as instance variable

Re: Lists in classes

2007-07-12 Thread Alex Popescu
On Jul 12, 6:23 pm, Jeremy Lynch <[EMAIL PROTECTED]> wrote: > Hello, > > Learning python from a c++ background. Very confused about this: > > > class jeremy: > list=[] > def additem(self): > self.list.append("hi") > return > > te

Re: Lists in classes

2007-07-12 Thread Jennifer Thacher
Jeremy Lynch wrote: > Hello, > > Learning python from a c++ background. Very confused about this: > > > class jeremy: > list=[] > def additem(self): > self.list.append("hi") > return > > temp = jeremy() > temp.additem() > temp.additem(

Re: Lists in classes

2007-07-12 Thread Wildemar Wildenburger
Bart Ogryczak wrote: > On 12 jul, 17:23, Jeremy Lynch <[EMAIL PROTECTED]> wrote: > >> Hello, >> >> Learning python from a c++ background. Very confused about this: >> >> >> class jeremy: >> list=[] >> > > You've defined list (very bad choice of a name, BTW), as a class

Re: web page text extractor

2007-07-12 Thread Alex Popescu
On Jul 12, 5:24 pm, "Andre Engels" <[EMAIL PROTECTED]> wrote: > 2007/7/12, Andre Engels <[EMAIL PROTECTED]>: > > I forgot to include > > import urllib2, re > > here > > > def textonly(url): > ># Get the HTML source on url and give only the main text > >f = urllib2.urlopen(url) > >text =

Re: web page text extractor

2007-07-12 Thread kublai
On Jul 12, 10:22 pm, Jon Rosebaugh <[EMAIL PROTECTED]> wrote: > On 2007-07-12 04:42:25 -0500, kublai <[EMAIL PROTECTED]> said: > > > For a project, I need to develop a corpus of online news stories. I'm > > looking for an application that, given the url of a web page, "copies" > > the rendered tex

Re: Lists in classes

2007-07-12 Thread Jeremy Lynch
Thanks for all the replies, very impressive. Got it now. Jeremy. On Jul 12, 4:23 pm, Jeremy Lynch <[EMAIL PROTECTED]> wrote: > Hello, > > Learning python from a c++ background. Very confused about this: > > > class jeremy: > list=[] > def additem(self): >

Re: Re-raising exceptions with modified message

2007-07-12 Thread samwyse
On Jul 12, 6:31 am, samwyse <[EMAIL PROTECTED]> wrote: > On Jul 8, 8:50 am, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > > > With Py 2.5 I get: > > > new.__class__ = old.__class__ > > TypeError: __class__ must be set to a class Hmmm, under Python 2.4.X, printing repr(old.__class__) gives

Re: os.wait() losing child?

2007-07-12 Thread Jason Zheng
Hrvoje Niksic wrote: >> greg wrote: > > Actually, it's not that bad. _cleanup only polls the instances that > are no longer referenced by user code, but still running. If you hang > on to Popen instances, they won't be added to _active, and __init__ > won't reap them (_active is only populated f

MP3 AVI DIVX MPEG SOFT = www.GEGEREKA.com

2007-07-12 Thread GEGEREKA!
Millions files for everyone. Music, movies, soft and other media. Check it now!! http://www.gegereka.com -- http://mail.python.org/mailman/listinfo/python-list

Re: storing pickles in sql data base

2007-07-12 Thread Chris Mellon
On 12 Jul 2007 06:00:59 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 11 Jul 2007 17:14:43 -0500, Chris Mellon wrote: > > > [pickle] > > > > Protocol 0 (the default) is a text protocol, it's safe to store in a > > text field or write to a text file. > > It's not really a text p

Re: Lists in classes

2007-07-12 Thread Jason Drew
Thanks for clearing up the other incorrect answers! In true Python fashion, I would also remind everyone of the *documentation* - in particular the Python tutorial. These are very elementary mistakes to be making - even worse as part of attempted answers. The Python tutorial is at http://docs.pyth

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-12 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > Donn Cave wrote: > > Someday we will look at "variables" like we look at goto. > > > How very functional. I believe some people naturally think in terms of > state transformations and some in terms of functional evaluation

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-12 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: > Paul Rubin writes: > > > The idea of designing languages with more and more support for > > ensuring program correctness is to put the established, repetitive > > processes into the computer where

Re: Tuple vs List: Whats the difference?

2007-07-12 Thread Shafik
Thanks to all of you, Im sure I'll pick your brains some more later down the line. --Shafik -- http://mail.python.org/mailman/listinfo/python-list

Re: web page text extractor

2007-07-12 Thread Stefan Behnel
kublai wrote: > For a project, I need to develop a corpus of online news stories. I'm > looking for an application that, given the url of a web page, "copies" > the rendered text of the web page (not the source HTNL text), opens a > text editor (Notepad), and displays the copied text for the user

Re: Problem with building extension in Python

2007-07-12 Thread cornpicker
On Jul 5, 4:33 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 05 Jul 2007 05:08:58 -0300, <[EMAIL PROTECTED]> > escribió: > > > I have already install Microsoft visual studio .NET 2003 and MinGw, > > when I try to build a extension: > > Is this for Python 2.4? I think you can't compil

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-12 Thread Paul Rubin
Donn Cave <[EMAIL PROTECTED]> writes: > Don't worry - there will be a state transformation monad for you! > > Nature or nurture? it would be interesting to see some identical twin > studies on novice programmers. Since few of us were exposed first > to strictly functional programming, though, yo

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-12 Thread Chris Mellon
On 7/12/07, Donn Cave <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Ben Finney <[EMAIL PROTECTED]> wrote: > > > Paul Rubin writes: > > > > > The idea of designing languages with more and more support for > > > ensuring program correctness is to put the e

Re: os.wait() losing child?

2007-07-12 Thread Nick Craig-Wood
Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood <[EMAIL PROTECTED]> writes: > > >> I think your polling way works; it seems there no other way around this > >> problem other than polling or extending Popen class. > > > > I think polling is probably the right way of doing it... > >

Re: Problem with Python's "robots.txt" file parser in module robotparser

2007-07-12 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, John Nagle <[EMAIL PROTECTED]> wrote: > Nikita the Spider wrote: > > > > > Hi John, > > Are you sure you're not confusing your sites? The robots.txt file at > > www.ibm.com contains the double slashed path. The robots.txt file at > > ibm.com is different and c

Re: asyncore and OOB data

2007-07-12 Thread Douglas Wells
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> writes: > Douglas Wells wrote: > > > > Third, the TCP protocol, which you have selected via the SOCK_STREAM > > option doesn't support OOB at all, so there's no way that you can > > even send OOB data in the manner that you are expec

Re: asyncore and OOB data

2007-07-12 Thread Douglas Wells
In article <[EMAIL PROTECTED]>, billiejoex <[EMAIL PROTECTED]> writes: > Douglas Wells wrote: > > > Second, when I look at the FTP specification, I don't find the > > concept of OOB anywhere. So, it's not clear what OOB data would > > mean in terms of the defined FTP commands in any case. > > S

Re: lists and dictionaries

2007-07-12 Thread Ladislav Andel
Thank you to all of you guys. It's exactly I was looking for. > You provide scant information for this task. For example, is the > new list ordered or unordered? Can the list corresponding to the > 'transports' key contain duplicates? > unordered is fine.. I will be storing it in DB from that

Re: Lists in classes

2007-07-12 Thread Bruno Desthuilliers
Alex Popescu a écrit : (snip) > > You are defining the list in the class context and so it becomes a > class field/member. 'attribute' is the pythonic term. -- http://mail.python.org/mailman/listinfo/python-list

Re: lists and dictionaries

2007-07-12 Thread Ladislav Andel
Thank you to all of you guys. It's exactly I was looking for. Lada Bart Ogryczak wrote: > On 12 jul, 04:49, anethema <[EMAIL PROTECTED]> wrote: > >>> li = [ {'index': 0, 'transport': 'udp', 'service_domain': >>> 'dp0.example.com'}, >>> {'index': 1, 'transport': 'udp', 'service_domain

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-12 Thread Paul Rubin
"Chris Mellon" <[EMAIL PROTECTED]> writes: > You can't prove a program to be correct, in the sense that it's proven > to do what it's supposed to do and only what it's supposed to do. You > can prove type-correctness, and the debate is really over the extent > that a type-correct program is also be

Class decorators do not inherit properly

2007-07-12 Thread Chris Fonnesbeck
I have a class that does MCMC sampling (Python 2.5) that uses decorators -- one in particular called _add_to_post that appends the output of the decorated method to a class attribute. However, when I subclass this base class, the decorator no longer works: Traceback (most recent call last): F

Re: profiling a C++ python extension

2007-07-12 Thread Matthew Woodcraft
rasmus <[EMAIL PROTECTED]> wrote: > I have used gprof to profile stand alone C++ programs. I am also > aware of pure python profilers. However, is there a way to get > profile information on my C++ functions when they are compiled in a > shared library (python extension module) and called from p

Re: os.wait() losing child?

2007-07-12 Thread Matthew Woodcraft
Jason Zheng <[EMAIL PROTECTED]> wrote: >Hrvoje Niksic wrote: >> Actually, it's not that bad. _cleanup only polls the instances that >> are no longer referenced by user code, but still running. If you hang >> on to Popen instances, they won't be added to _active, and __init__ >> won't reap them (

Re: web page text extractor

2007-07-12 Thread kublai
On Jul 13, 2:19 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > kublai wrote: > > For a project, I need to develop a corpus of online news stories. I'm > > looking for an application that, given the url of a web page, "copies" > > the rendered text of the web page (not the source HTNL text), opens

inspite of proper package structure, no module named xyz error.

2007-07-12 Thread krishnakant Mane
hello all, can some one suggest me the best solution for a package? I have a package folder called idm and there are the following files in there. __init__.py which is right now empty. mainwindow.py which has a single class called MainWindow which is an MDI Parent frame from wxpython. student.py wh

Re: bash-style pipes in python?

2007-07-12 Thread Dan Stromberg - Datallegro
On Wed, 11 Jul 2007 20:55:48 -0700, faulkner wrote: > On Jul 11, 8:56 pm, Dan Stromberg - Datallegro > <[EMAIL PROTECTED]> wrote: >> I'm constantly flipping back and forth between bash and python. >> >> Sometimes, I'll start a program in one, and end up recoding in the >> other, or including a bun

DBXML and the Xerces DOM

2007-07-12 Thread nikki
I downloaded Berkeley DB XML and put together a test script to load a large 250mb XML file into the database. Storage and retrieval works great, but I need DOM access to the file without loading it all into a string and re-parsing it. In the c++ api (they used swig to expose c+ + to python) it sa

Best way to add values from keys

2007-07-12 Thread robinsiebler
I have a data structure that looks like this: dates = {}; last_song = [] #; year = {}; week = {}; date = {}; artist = []; song = {} #dates = {'2007': {'25': {'06/23/07': {'aerosmith': [{'sweet emotion': 1}, {'dream on': 2}], # 'Metallica': [{'Fade t

Re: bool behavior in Python 3000?

2007-07-12 Thread Bjoern Schliessmann
Alan Isaac wrote: > Bjoern Schliessmann wrote: >> Is there any type named "bool" in standard Python? type(True) > Thanks anyway, but I remembered it shortly after sending. Thus the cancel (seems to have failed a bit). Regards, Björn -- BOFH excuse #384: it's an ID-10-T error -- ht

wx.App console window [Windows]

2007-07-12 Thread siwiak
Hi All, I'm looking for a way to hide console window created by wx.App class. examplary code below: import wx class Gui(wx.App): def __init__(self, *pargs, **kwargs): wx.App.__init__(self, *pargs, **kwargs) if __name__ == "__main__": app = Gui() app.MainLoop()

Re: bool behavior in Python 3000?

2007-07-12 Thread Bjoern Schliessmann
Steven D'Aprano wrote: > It seems to me that you deliberately misunderstood him. I know for sure I didn't. > Why else would you type-cast the integers 2 and 1 to bools to > supposedly demonstrate that there's nothing wrong with operations > between bools returning ints? Kindly excuse me bother

Re: os.wait() losing child?

2007-07-12 Thread Jason Zheng
Nick Craig-Wood wrote: > Sure! > > You could get rid of this by sleeping until a SIGCHLD arrived maybe. Yah, I could also just dump Popen class and use fork(). But then what's the point of having an abstraction layer any more? >> This can still be a problem for applications that call wait in a

Re: os.wait() losing child?

2007-07-12 Thread Hrvoje Niksic
Nick Craig-Wood <[EMAIL PROTECTED]> writes: >> This can still be a problem for applications that call wait in a >> dedicated thread, but the program can always ignore the processes >> it doesn't know anything about. > > Ignoring them isn't good enough because it means that the bit of > code whi

How to create new files?

2007-07-12 Thread Robert Dailey
Hi, I'm trying to create a Python equivalent of the C++ "ifstream" class, with slight behavior changes. Basically, I want to have a "filestream" object that will allow you to overload the '<<' and '>>' operators to stream out and stream in data, respectively. So far this is what I have: class fi

New guy help with setup

2007-07-12 Thread meg99
I just downloaded 2.5 and read the readme file. It says "Before you can build Python, you must first confiigure itStart by running the script "./configure". I can't find "./configure" I am running Windows XP SP2 btw Python.exe gives me a black window Pythonw.exe does nothing (I assume this

Re: bool behavior in Python 3000?

2007-07-12 Thread Alexander Schmolck
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Expressions like (i == j) used to return 0 and 1, and it was to avoid > breaking hacks like the above that bools were implemented as a subclass of > int, not because being able to write the above was a specific feature > requested. In the hypothetical

Re: New guy help with setup

2007-07-12 Thread Paul McNett
meg99 wrote: > I just downloaded 2.5 and read the readme file. It says "Before you > can build Python, you must first confiigure itStart by running the > script "./configure". > > I can't find "./configure" > > I am running Windows XP SP2 You downloaded the wrong file. You want the Windows

Re: New guy help with setup

2007-07-12 Thread meg99
On Jul 12, 4:24 pm, Paul McNett <[EMAIL PROTECTED]> wrote: > meg99 wrote: > > I just downloaded 2.5 and read the readme file. It says "Before you > > can build Python, you must first confiigure itStart by running the > > script "./configure". > > > I can't find "./configure" > > > I am running

Re: New guy help with setup

2007-07-12 Thread Paul McNett
meg99 wrote: > On Jul 12, 4:24 pm, Paul McNett <[EMAIL PROTECTED]> wrote: >> meg99 wrote: >>> I just downloaded 2.5 and read the readme file. It says "Before you >>> can build Python, you must first confiigure itStart by running the >>> script "./configure". >>> I can't find "./configure" >>>

Re: Where does str class represent its data?

2007-07-12 Thread ChrisEdgemon
On Jul 11, 9:49 pm, James Stroud <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I'd like to implement a subclass of string that works like this: > > m = MyString('mail') > m == 'fail' > > > True > > m == 'mail' > > > False > > m in ['fail', hail'] > > > True > > > My best

Function parameter type safety?

2007-07-12 Thread Robert Dailey
Hi, Is there a way to force a specific parameter in a function to be a specific type? For example, say the first parameter in a function of mine is required to be a string. If the user passes in an integer, I want to notify them that they should pass in a string, not an integer. -- http://mail.p

Re: New guy help with setup

2007-07-12 Thread meg99
On Jul 12, 4:35 pm, Paul McNett <[EMAIL PROTECTED]> wrote: > meg99 wrote: > > On Jul 12, 4:24 pm, Paul McNett <[EMAIL PROTECTED]> wrote: > >> meg99 wrote: > >>> I just downloaded 2.5 and read the readme file. It says "Before you > >>> can build Python, you must first confiigure itStart by runn

  1   2   >