Re: Regular expression that skips single line comments?

2009-01-19 Thread martinjamesevans
Firstly, a huge thanks to all for the solutions! Just what I was looking for. > (Aside: why are you doing a case-insensitive match for a non-letter? Are > there different upper- and lower-case dollar signs?) As you can probably imagine, I had simplified the problem slightly, the language uses

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Paul Rubin
"Tim Rowe" writes: > I was actually at the European Space Agency's Toulouse site the week > after the Ariane 5 incident. I've been at jollier funerals. I can't > help thinking that thinking that the team would have benefited from > reading David Parnas's work on the specification of the A-7E avion

Re: reading file to list

2009-01-19 Thread alex23
On Jan 20, 1:39 pm, Xah Lee wrote: > consider code produced by corporations, as opposed to with respect to > some academic or philsophical logical analysis. Looked in another way, > consider if we can compile stat of all existing pyhton code used in > real world, you'll find the above style is rar

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Paul Rubin
"Tim Rowe" writes: > Unless it's changed since I used it, technically, SPADE doesn't allow > or disallow anything. Right, it's an external tool, like pylint; you can still compile code that SPADE complains about. Sorry if I wan't more clear. I just meant SPADE would flag the code. > Since the

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 10:33 pm, Luis Zarrabeitia wrote: > So, Arianne 5's problem had nothing to do with _enforced data hiding_. (Why do > you keep calling it 'encapsulation'?). I keep calling it encapsulation because that is a widely accepted, albeit not universal, definition of encapsulation. Google "enc

Re: what's the point of rpython?

2009-01-19 Thread Kay Schluehr
On 17 Jan., 01:37, "Brendan Miller" wrote: > Is this going anywhere or is this just architecture astronautics? > > The RPython project seems kind of interseting to me and I'd like to > see more python implementations, but looking at the project I can't > help but think that they haven't really ex

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
On 1/19/2009 5:03 PM Terry Reedy apparently wrote: I have not seen 3.0 emit a % deprecation warning. Point taken. But the vocabulary of PEP 4 suggests that "obsolete" and "deprecated" are synonyms, and PEP 4 lists obsolete modules without deprecation warnings. Alan Isaac -- http://mail.pytho

Re: ifconfig in python

2009-01-19 Thread alex goretoy
ifconfig -a|grep "inet addr"|awk '{print $2}' wget http://myip.dk&&; cat index.html|grep "http://www.alexgoretoy.com somebodywhoca...@gmail.com On Tue, Jan 20, 2009 at 3:42 AM, Дамјан Георгиевски wrote: > Something *like* this could work: > >myip = > urllib2.urlopen('http://whatismyip

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
On 1/19/2009 3:03 PM John Machin apparently wrote: It is not deprecated YET; see this: http://docs.python.org/3.0/whatsnew/3.0.html#changes-already-present-in-python-2-6 PEP 3101: Advanced String Formatting. Note: the 2.6 description mentions the format() method for both 8-bit and Unicode strin

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Luis Zarrabeitia
Quoting "Russ P." : > On Jan 19, 9:21 pm, Paul Rubin wrote: > > Bruno Desthuilliers writes: > > > The failure was because a module tested, QA'd and certified within a > > > given context (in which it was ok to drop the builtin error handling) > > > was reused in a

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Luis Zarrabeitia
Quoting Paul Rubin <"http://phr.cx"@NOSPAM.invalid>: > Luis Zarrabeitia writes: > > > Luis Zarrabeitia writes: > > class ImmutableType(type): ... > > Thanks for posting this, I haven't replied because I bookmarked the > post for later study, but that was several days ago, so I just wanted > to

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 9:21 pm, Paul Rubin wrote: > Bruno Desthuilliers writes: > > The failure was because a module tested, QA'd and certified within a > > given context (in which it was ok to drop the builtin error handling) > > was reused in a context where it was not ok. And

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Paul Rubin
Bruno Desthuilliers writes: > Take some not-that-trivial projects like Zope/Plone. There are quite a > few lines of code involved, and quite a lot of programmers worked on it. Zope is about 375 KLOC[1], which I agree is not trivial, but by today's standards, it's not all that large. Zope also ha

Re: *Advanced* Python book?

2009-01-19 Thread Banibrata Dutta
2009/1/17 Michele Simionato : > "Expert Python Programming" by Tarek Ziadé is quite good and I wrote > a review for it: > > http://www.artima.com/weblogs/viewpost.jsp?thread=240415 Excellent review. -- regards, Banibrata http://www.linkedin.com/in/bdutta -- http://mail.python.org/mailman/listinf

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Paul Rubin
Bruno Desthuilliers writes: > The failure was because a module tested, QA'd and certified within a > given context (in which it was ok to drop the builtin error handling) > was reused in a context where it was not ok. And the point is exactly > that : no *technology* can solve this kind of problem

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 8:32 pm, Luis Zarrabeitia wrote: > Quoting "Russ P." : > > > On Jan 19, 7:44 pm, wrote: > > > [removing david's message] > > > Why did you email your post to me? Did you really think I wanted to > > see it in my inbox? I assure you I did not. > > Don't get mad at him... and don't take

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 8:39 pm, Luis Zarrabeitia wrote: > If properties already > let you change from attribute to method without affecting the caller, why do > you > need a property that does nothing? You don't. As I tried to explain in a earlier post (but one that you may not have seen yet), that is appa

Re: python resource management

2009-01-19 Thread Tim Arnold
"Philip Semanchuk" wrote in message news:mailman.7530.1232375454.3487.python-l...@python.org... > > On Jan 19, 2009, at 3:12 AM, S.Selvam Siva wrote: > >> Hi all, >> >> I am running a python script which parses nearly 22,000 html files >> locally >> stored using BeautifulSoup. >> The problem is

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Paul Rubin
Luis Zarrabeitia writes: > > Luis Zarrabeitia writes: > > > You *can* implement a metaclass that will remove the dynasmism from its > > > instances > import inspect > class ImmutableType(type): ... Thanks for posting this, I haven't replied because I bookmarked the post for later study, but

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 2:39 PM, Luis Zarrabeitia wrote: > This line would make a lot more sense if you were talking about Java's getters > and setters, or about a language where accessing a property is different than > accessing an attribute (which would make little sense). If properties already

Re: pep 8 constants

2009-01-19 Thread Ben Finney
Steven D'Aprano writes: > But regardless... yes, it is in my opinion Pythonic to use ALLCAPS > to designate constants (by convention). I agree, in general. Though I think I can count the number of times I've wanted to use an ‘UPPER_CASE’-named constant in my code, on the fingers of one foot. >

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Luis Zarrabeitia
Quoting "Russ P." : > In the circle example, properties are nice for guaranteeing > consistency between the radius and the area, but they are not of much > use if you decide later that the client should not be allowed to > change either one. Well... I suppose you could define the setter to do > n

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Luis Zarrabeitia
Quoting "Russ P." : > On Jan 19, 5:09 pm, Luis Zarrabeitia wrote: > > > Russ, I think _you_ are missing the point. > > If the attribute is already public, why does it need properties? Why would > a > > programmer go to the trouble of adding them manually, just to get one level > of > > indirect

Re: what's the point of rpython?

2009-01-19 Thread Paul Rubin
"Brendan Miller" writes: > As long as you can atomically increment and decrement an integer > without locking you are pretty much done. Most cpu's can't do that. > For a reference implementation of lock free reference counting on all > common platforms check out boosts implementation of shared_p

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Luis Zarrabeitia
Quoting "Russ P." : > On Jan 19, 7:44 pm, wrote: > > [removing david's message] > > > Why did you email your post to me? Did you really think I wanted to > see it in my inbox? I assure you I did not. Don't get mad at him... and don't take it personal. The reply-to header of this mailing list (u

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 8:17 pm, Luis Zarrabeitia wrote: > Quoting "Russ P." : > > > > > > > On Jan 19, 6:24 pm, "James Mills" > > wrote: > > > > Python programmers tend to not have a need for > > > properties. Quite honestly they are a waste of time. > > > They come from traditional OO approaches to software

Re: what's the point of rpython?

2009-01-19 Thread Carl Banks
On Jan 19, 8:00 pm, "Brendan Miller" wrote: > Maybe I'm missing something here but a lock free algorithm for > reference counting seems pretty trivial. As long as you can atomically > increment and decrement an integer without locking you are pretty much > done. You're missing that most of the pl

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Luis Zarrabeitia
Quoting Luis Zarrabeitia : > > Quoting "Russ P." : > > > On Jan 19, 6:24 pm, "James Mills" > > wrote: > > > > > Python programmers tend to not have a need for > > > properties. Quite honestly they are a waste of time. > > > They come from traditional OO approaches to software design > > > (an

Re: s=str(binary)

2009-01-19 Thread John Machin
On Jan 20, 12:54 pm, gert wrote: > How do you convert s back to binary data in python 3 so I can put in a > sqlite blob ? > Is there a build in function or do I need to use binascii ? > byte(s) or bin(s) would make more sense but can not figure it out ? Can't imagine why you would do str(binary_d

Re: what's the point of rpython?

2009-01-19 Thread Paul Rubin
"Brendan Miller" writes: > Maybe I'm missing something here but a lock free algorithm for > reference counting seems pretty trivial. As long as you can atomically > increment and decrement an integer without locking you are pretty much > done. What cpu's do you know of that can atomically increme

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 7:09 pm, "Russ P." wrote: > The benefit of automatically converting public data into properties, I > assume, is to relieve the programmer of doing it manually. The > programmer will obviously need to add any functionality when needed, > but he does not need to create the function heade

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Luis Zarrabeitia
Quoting "Russ P." : > On Jan 19, 6:24 pm, "James Mills" > wrote: > > > Python programmers tend to not have a need for > > properties. Quite honestly they are a waste of time. > > They come from traditional OO approaches to software design > > (and mostly from the Java world). > > With statemen

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Luis Zarrabeitia
Quoting "Russ P." : > One of the main benefits of properties is that they allow you to more > safely put attributes in the public interface. If you later decide > that the attribute shouldn't have been in the public interface, you > can convert it to a property and make it do whatever you want it

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 7:44 pm, wrote: > >> Because frankly, that's how I read Russ' explanation for what Scala is > >> doing. Have I missed something? > > coz he gets paid per line of code > > it's a mindless way of getting paid more for the same functionality... > > >> Well, I *thought* I did, and (unli

Re: pep 8 constants

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 19:11:16 -0800, Brendan Miller wrote: >> Constants would be a nice addition in python, sure enough. > > My original question was about PEP-8 and whether it is pythonic to use > all caps to denote a variable that shouldn't be changed. More of a style > question than a language

Re: ifconfig in python

2009-01-19 Thread Дамјан Георгиевски
Something *like* this could work: myip = urllib2.urlopen('http://whatismyip.org/').read() of course then you are depending on an external service, not a very reliable one even. But then again, you might create an internal service like that yourself. This cgi-bin shell code like this fo

Re: what's the point of rpython?

2009-01-19 Thread Brendan Miller
Maybe I'm missing something here but a lock free algorithm for reference counting seems pretty trivial. As long as you can atomically increment and decrement an integer without locking you are pretty much done. For a reference implementation of lock free reference counting on all common platforms

Re: braces fixed '#{' and '#}'

2009-01-19 Thread Tim Roberts
"Brendan Miller" wrote: > >Yes, I also recently noticed the bug in python's parser that doesn't >let it handle squigly braces and the bug in the lexer that makes white >space significant. I'm surprised the dev's haven't noticed this yet. It's very dangerous to make a post like this without includ

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread david.lyon
>> Because frankly, that's how I read Russ' explanation for what Scala is >> doing. Have I missed something? coz he gets paid per line of code it's a mindless way of getting paid more for the same functionality... >> Well, I *thought* I did, and (unlike Bruno) I'm not hostile to the idea >>

Re: reading file to list

2009-01-19 Thread Xah Lee
On Jan 19, 4:49 pm, "Rhodri James" wrote: > On Sun, 18 Jan 2009 08:31:15 -, Xah Lee wrote: > > On Jan 17, 10:25 am, Tino Wildenhain wrote: > >> > [[int(x) for x in line.split()] for line in open("blob.txt")] > > > Nice (python code). > > > Few comments: > > > • the above code is borderline o

Re: function to find the modification date of the project

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 1:22 PM, Joe Strout wrote: > Any comments on the functioning and platform-independence of the code? Make it simpler :) cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 6:24 pm, "James Mills" wrote: > Python programmers tend to not have a need for > properties. Quite honestly they are a waste of time. > They come from traditional OO approaches to software design > (and mostly from the Java world). With statements like that, it's no wonder you don't u

Re: function to find the modification date of the project

2009-01-19 Thread Joe Strout
Terry Reedy wrote: Yes, and presumably if some power user did this, then that would be the intended effect. Not sure why they'd do that, but they must have a good reason -- who am I to stop them? What if a curious user simple looks at a file with an editor and saves it without change? You

Re: pep 8 constants

2009-01-19 Thread Brendan Miller
> Constants would be a nice addition in python, sure enough. My original question was about PEP-8 and whether it is pythonic to use all caps to denote a variable that shouldn't be changed. More of a style question than a language question. I actually think *enforcing* constantness seems to go aga

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 6:24 pm, Steven D'Aprano wrote: > On Mon, 19 Jan 2009 18:07:50 -0800, Russ P. wrote: > > On Jan 19, 5:09 pm, Luis Zarrabeitia wrote: > > >> Russ, I think _you_ are missing the point. If the attribute is already > >> public, why does it need properties? Why would a programmer go to the

Re: ifconfig in python

2009-01-19 Thread Mark Wooding
"James Mills" writes: > On Tue, Jan 20, 2009 at 10:28 AM, Nehemiah Dacres > wrote: >> Is ther an easy way to get the resolved ip address of the machine a >> script is running on? socket.gethostbyname(socket.gethostname) has >> only returned the ip address of my loop back interface ... not very

Re: tasklet library based on PEP 0342

2009-01-19 Thread charlie137
On Jan 20, 6:37 am, Terry Reedy wrote: > charlie...@gmail.com wrote: > > Using new features of python generators, as described in PEP 0342, it > > is possible to write some sort of "tasklets" in a maner very similar > > to stackless python, but running on cpython. For example : > > > @tasklet > >

Re: ifconfig in python

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 12:48 PM, Ned Deily wrote: > Also, since the subject is on my brain at the moment, how to find "the > address" is not the right question to ask. These days most systems have > multiple network interfaces (Ethernet, WiFi, dialup, et al) running > multiple protocols, like IP

Re: Two questions about style and some simple math

2009-01-19 Thread John Machin
On Jan 20, 12:15 pm, Spoofy wrote: > Hello everybody! > > Though I'm a hobby programmer for years now (mainly small hackery > things) I still have big problems getting "real" things to work. > > I'm currently trying to write a simple RPG and have problems with > the following: > > 1. > > Character

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 6:24 pm, Steven D'Aprano wrote: > On Mon, 19 Jan 2009 18:07:50 -0800, Russ P. wrote: > > On Jan 19, 5:09 pm, Luis Zarrabeitia wrote: > > >> Russ, I think _you_ are missing the point. If the attribute is already > >> public, why does it need properties? Why would a programmer go to the

Re: Relax Syntax for Augmented Arithmetic?

2009-01-19 Thread Mark Wooding
Steven D'Aprano writes: > There's a practical reason too. You create a new Foo instance, mutate > it with the augmented assignment operator, and then a tenth of a > millisecond later the garbage collector throws it away because it has > a reference count of zero. Only in this specific example.

Re: ifconfig in python

2009-01-19 Thread Ned Deily
In article , "James Mills" wrote: > On Tue, Jan 20, 2009 at 10:28 AM, Nehemiah Dacres > wrote: > > Is ther an easy way to get the resolved ip address of the machine a script > > is running on? socket.gethostbyname(socket.gethostname) has only returned > > the ip address of my loop back interf

Re: Event Handling and Signal-Slot Mechanism

2009-01-19 Thread Steven Woody
On Tue, Jan 20, 2009 at 1:03 AM, BlueBird wrote: > On Jan 19, 4:10 am, Steven Woody wrote: >> Hi, >> >> Python has Signal-Slot mechanism, > > Python does not have signal/slot mechanism. You are talking about the > Qt toolkit, which is initially a (nice) C++ toolkit, available also in > python via

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 18:07:50 -0800, Russ P. wrote: > On Jan 19, 5:09 pm, Luis Zarrabeitia wrote: > >> Russ, I think _you_ are missing the point. If the attribute is already >> public, why does it need properties? Why would a programmer go to the >> trouble of adding them manually, just to get on

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 12:07 PM, Russ P. wrote: >> Russ, I think _you_ are missing the point. >> If the attribute is already public, why does it need properties? Why would a >> programmer go to the trouble of adding them manually, just to get one level >> of >> indirection for an already public

modify IDLE?

2009-01-19 Thread Brian Blais
Hello, I was wondering if there is a simple way to modify IDLE, adding or replacing menus? I haven't dug into the source code yet, but was wondering if anyone else has done something like this. I have a couple of projects that require users to write python code (or very similar to pytho

Re: Two questions about style and some simple math

2009-01-19 Thread Mensanator
On Jan 19, 7:44 pm, "Rhodri James" wrote: > On Tue, 20 Jan 2009 01:15:47 -, Spoofy wrote: > > Hello everybody! > > > Though I'm a hobby programmer for years now (mainly small hackery   > > things) I still have big problems getting "real" things to work. > > > I'm currently trying to write a s

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Russ P.
On Jan 19, 5:09 pm, Luis Zarrabeitia wrote: > Russ, I think _you_ are missing the point. > If the attribute is already public, why does it need properties? Why would a > programmer go to the trouble of adding them manually, just to get one level of > indirection for an already public attribute?

s=str(binary)

2009-01-19 Thread gert
How do you convert s back to binary data in python 3 so I can put in a sqlite blob ? Is there a build in function or do I need to use binascii ? byte(s) or bin(s) would make more sense but can not figure it out ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Two questions about style and some simple math

2009-01-19 Thread MRAB
Spoofy wrote: Hello everybody! Though I'm a hobby programmer for years now (mainly small hackery things) I still have big problems getting "real" things to work. I'm currently trying to write a simple RPG and have problems with the following: 1. Characters have a "courage" attribute that

Re: Two questions about style and some simple math

2009-01-19 Thread Rhodri James
On Tue, 20 Jan 2009 01:15:47 -, Spoofy wrote: Hello everybody! Though I'm a hobby programmer for years now (mainly small hackery things) I still have big problems getting "real" things to work. I'm currently trying to write a simple RPG and have problems with the following: 1. Cha

Two questions about style and some simple math

2009-01-19 Thread Spoofy
Hello everybody! Though I'm a hobby programmer for years now (mainly small hackery things) I still have big problems getting "real" things to work. I'm currently trying to write a simple RPG and have problems with the following: 1. Characters have a "courage" attribute that basically deter

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-19 Thread Luis Zarrabeitia
Quoting "Russ P." : > On Jan 19, 7:13 am, Bruno Desthuilliers 42.desthuilli...@websiteburo.invalid> wrote: > > > I must be missing the point : if it's a public attribute, it doesn't > > need a "property" ? I guess we use the same words for different things > here. > > Yes, you are missing more

Re: function to find the modification date of the project

2009-01-19 Thread Scott David Daniels
Joe Strout wrote: This isn't a question, but something I thought others may find useful (and if somebody can spot any errors with it, I'll be grateful). We had a case recently where the client was running an older version of our app, and didn't realize it. In other languages I've avoided this

Re: A java hobbyist programmer learning python

2009-01-19 Thread Rhodri James
On Sun, 18 Jan 2009 02:24:51 -, Steven D'Aprano wrote: Let me re-write your code in a more Pythonic way. This is not the only way to do this, and it probably isn't the best way, but it may give you a flavour for the way Python is usually written. import sys import operator class Calc

Re: reading file to list

2009-01-19 Thread Rhodri James
On Sun, 18 Jan 2009 08:31:15 -, Xah Lee wrote: On Jan 17, 10:25 am, Tino Wildenhain wrote: > [[int(x) for x in line.split()] for line in open("blob.txt")] Nice (python code). Few comments: • the above code is borderline of atypical. e.g. it is not a average python code would produce o

Re: Logging help

2009-01-19 Thread Chris Rebert
On Mon, Jan 19, 2009 at 11:36 AM, koranthala wrote: > Hi, > Is it possible somehow to have the logging module rotate the files > every time I start it. > Basically, I can automatically rotate using RotatingFileHandler; > Now I want it rotated every time I start the program too. Just call the

Re: defining class functions

2009-01-19 Thread Astan Chee
Actually, yes, I just realized a better way of doing this without state change based on the requirement. Thanks for the info anyway Nehemiah Dacres wrote: wouldn't you use a state change? Use a variable to indicate which function you want the first class to do On Mon, Jan 19, 2009 at 6:31 PM,

Re: defining class functions

2009-01-19 Thread James Stroud
Astan Chee wrote: Hi, I have two classes in python that are in two different files/python scripts. Class A uses Class B like this: class B(object): def function1(self,something): pass def function2(self,something): print "hello one" print something class A(object):

Re: ifconfig in python

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 10:28 AM, Nehemiah Dacres wrote: > Is ther an easy way to get the resolved ip address of the machine a script > is running on? socket.gethostbyname(socket.gethostname) has only returned > the ip address of my loop back interface ... not very usefull. That's because your /e

Re: defining class functions

2009-01-19 Thread Nehemiah Dacres
wouldn't you use a state change? Use a variable to indicate which function you want the first class to do On Mon, Jan 19, 2009 at 6:31 PM, James Mills wrote: > On Tue, Jan 20, 2009 at 10:08 AM, Astan Chee wrote: > > Hi, > > I have two classes in python that are in two different files/python > sc

Re: defining class functions

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 10:08 AM, Astan Chee wrote: > Hi, > I have two classes in python that are in two different files/python scripts. > Class A uses Class B like this: > class B(object): > def function1(self,something): > pass > def function2(self,something): > print "hello one"

Re: wsgi silently swallows errors

2009-01-19 Thread Дамјан Георгиевски
> Consider the following wsgi app: > > def application(env, start_response): > start_response('200 OK',[('Content-type','text/plain')]) > yield "hello" > x=1/0 > yield "world" > > The result of this is that the web browser displays "hello" and an > error > message ends up in the web log

ifconfig in python

2009-01-19 Thread Nehemiah Dacres
Is ther an easy way to get the resolved ip address of the machine a script is running on? socket.gethostbyname(socket.gethostname) has only returned the ip address of my loop back interface ... not very usefull. -- "lalalalala! it's not broken because I can use it" http://linux.slashdot.org/com

defining class functions

2009-01-19 Thread Astan Chee
Hi, I have two classes in python that are in two different files/python scripts. Class A uses Class B like this: class B(object): def function1(self,something): pass def function2(self,something): print "hello one" print something class A(object): def __init__(self

Re: urllib2 httplib.BadStatusLine exception while opening a page on an Oracle HTTP Server

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 13:00:44 -0800, ak wrote: > Hi everyone, > > I have a problem with urllib2 on this particular url, hosted on an > Oracle HTTP Server > > http://www.orange.sk/eshop/sk/portal/catalog.html? type=post&subtype=phone&null > > which gets 302 redirected to > https://www.orange.sk/e

Re: function to find the modification date of the project

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 16:19:39 -0700, Joe Strout wrote: > James Mills wrote: > >> You know you could just store a __version__ attribute in your main >> library (__init__.py). :) > > What, and update it manually? I don't trust myself to remember to do > that every time! Presumably you have some s

Re: function to find the modification date of the project

2009-01-19 Thread Terry Reedy
Joe Strout wrote: James Mills wrote: Also I'd like to point out that your method is not very reliable as the modification time of those files could change at any moment. Consider unix systems for instnace where you could do: touch * And poof, you're modification times are now the current time

Re: function to find the modification date of the project

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 9:20 AM, Joe Strout wrote: > Yes, and presumably if some power user did this, then that would be the > intended effect. Not sure why they'd do that, but they must have a good > reason -- who am I to stop them? Actually I'm fairly certain there -could- potentially be tools

Re: function to find the modification date of the project

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 9:19 AM, Joe Strout wrote: > James Mills wrote: > >> You know you could just store a __version__ >> attribute in your main library (__init__.py). :) > > What, and update it manually? I don't trust myself to remember to do that > every time! If you read my post carefully y

Re: python resource management

2009-01-19 Thread Terry Reedy
S.Selvam Siva wrote: Hi all, I am running a python script which parses nearly 22,000 html files locally stored using BeautifulSoup. The problem is the memory usage linearly increases as the files are being parsed. When the script has crossed parsing 200 files or so, it consumes all the availa

Re: function to find the modification date of the project

2009-01-19 Thread Joe Strout
James Mills wrote: Also I'd like to point out that your method is not very reliable as the modification time of those files could change at any moment. Consider unix systems for instnace where you could do: touch * And poof, you're modification times are now the current time! Yes, and presum

Re: function to find the modification date of the project

2009-01-19 Thread Joe Strout
James Mills wrote: You know you could just store a __version__ attribute in your main library (__init__.py). :) What, and update it manually? I don't trust myself to remember to do that every time! Best, - Joe -- http://mail.python.org/mailman/listinfo/python-list

Problem with IDLE on windows XP

2009-01-19 Thread Grimes, George
I am trying to learn Python and I installed version 2.6 both at home and at work. At home, on Vista, everything works fine. At work, on XP, IDLE would not run. I uninstalled/reinstalled and got the same thing. My cursor changes to the wait symbol for a few seconds, then goes back to normal a

Re: function to find the modification date of the project

2009-01-19 Thread MRAB
Joe Strout wrote: This isn't a question, but something I thought others may find useful (and if somebody can spot any errors with it, I'll be grateful). We had a case recently where the client was running an older version of our app, and didn't realize it. In other languages I've avoided this

Re: function to find the modification date of the project

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 8:39 AM, James Mills wrote: > On Tue, Jan 20, 2009 at 7:44 AM, Joe Strout wrote: >> This isn't a question, but something I thought others may find useful (and >> if somebody can spot any errors with it, I'll be grateful). >> >> We had a case recently where the client was r

Re: function to find the modification date of the project

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 7:44 AM, Joe Strout wrote: > This isn't a question, but something I thought others may find useful (and > if somebody can spot any errors with it, I'll be grateful). > > We had a case recently where the client was running an older version of our > app, and didn't realize it

Re: tasklet library based on PEP 0342

2009-01-19 Thread Terry Reedy
charlie...@gmail.com wrote: Using new features of python generators, as described in PEP 0342, it is possible to write some sort of "tasklets" in a maner very similar to stackless python, but running on cpython. For example : @tasklet def my_task(): yield Timer(10) yield "result" @task

function to find the modification date of the project

2009-01-19 Thread Joe Strout
This isn't a question, but something I thought others may find useful (and if somebody can spot any errors with it, I'll be grateful). We had a case recently where the client was running an older version of our app, and didn't realize it. In other languages I've avoided this by displaying the

Re: Ordering attributes for dynamically generated class

2009-01-19 Thread David Pratt
Hi Aaron, this worked out fine. Using an ordered dict to subclass dict. Many thanks. David On Jan 18, 2009, at 11:57 AM, Aaron Brady wrote: On Jan 18, 9:52 am, David Pratt wrote: Hi list. I use 'type' to generate classes but have a need to order the attributes for the generated class. Of cou

Re: Beginner Question

2009-01-19 Thread Terry Reedy
K-Dawg wrote: I do no understand the underscore methods. Names of the form __xyx__ are defined by the language definition and recognized and used by the interpreter. See PythonLanguage / LexicalAnalysis / Identifiers / Reserved Most refer to methods, a few to other attributes. Modules may

Re: wsgi silently swallows errors

2009-01-19 Thread Graham Dumpleton
On Jan 20, 8:03 am, Jean-Paul Calderone wrote: > On Mon, 19 Jan 2009 12:15:29 -0800, Ron Garret wrote: > >Consider the following wsgi app: > > >def application(env, start_response): > >  start_response('200 OK',[('Content-type','text/plain')]) > >  yield "hello" > >  x=1/0 > >  yield "world" > >

Re: string formatting documentation

2009-01-19 Thread Terry Reedy
Alan G Isaac wrote: On Mon, 19 Jan 2009 14:44:01 +, Alan G Isaac wrote: we are supposed to prefer No, no 'supposed to's. You are not even 'supposed to' like or use Python. (Unless, I supposed, an employer demands it. But that is another story.) Certainly, one is not 'supposed to' pre

Re: urllib2 httplib.BadStatusLine exception while opening a page on an Oracle HTTP Server

2009-01-19 Thread ak
On Jan 19, 10:00 pm, ak wrote: > Hi everyone, > > I have a problem with urllib2 on this particular url, hosted on an > Oracle HTTP Server > > http://www.orange.sk/eshop/sk/portal/catalog.html?type=post&subtype=p... > > which gets 302 redirected > tohttps://www.orange.sk/eshop/sk/catalog/post/phon

Re: PyQt4 on Windows ?

2009-01-19 Thread Stephen Chapman
I have one running. actually use freezer to create an exe for it in windows. http://www.riverbankcomputing.co.uk/software/pyqt/download That will tell you how to get started. The app I wrote uses Pryro(with middleware server on a linux machine). And I use the standard widgets that qt has gri

Re: string formatting documentation

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 15:38:02 +, Alan G Isaac wrote: > But of more interest: you claim PEP 4 is not relevant, and that old > string formatting is NOT deprecated. I would like assurance that it is > not deprecated. Can you back that? If you want to know what python-dev have in mind, you have to

PyQt4 on Windows ?

2009-01-19 Thread Linuxguy123
What does it take to get a PyQt4 application running on a Windows machine ? I'm sorry if this is a redundant question, but I've searched this and I am not finding a comprehensive answer. If anyone is running a PyQt4 application on a Windows (XP or Vista) machine, I'd love to know how it works for

Re: Python Style Guide Questions - Contd.

2009-01-19 Thread Marc 'BlackJack' Rintsch
On Mon, 19 Jan 2009 05:50:54 -0800, koranthala wrote: > Hi, >I have some more questions about python code styling. 1. Global >Variables: In my code, I am using some global variables. > Now, when I ran PyLint, it raised convention errors mentioning that they > should be CAPITAL_ALPHABETS. N

Re: Regular expression that skips single line comments?

2009-01-19 Thread Steven D'Aprano
On Mon, 19 Jan 2009 08:08:01 -0800, martinjamesevans wrote: > I am trying to parse a set of files that have a simple syntax using RE. > I'm interested in counting '$' expansions in the files, with one minor > consideration. A line becomes a comment if the first non-white space > character is a sem

urllib2 httplib.BadStatusLine exception while opening a page on an Oracle HTTP Server

2009-01-19 Thread ak
Hi everyone, I have a problem with urllib2 on this particular url, hosted on an Oracle HTTP Server http://www.orange.sk/eshop/sk/portal/catalog.html?type=post&subtype=phone&null which gets 302 redirected to https://www.orange.sk/eshop/sk/catalog/post/phones.html, after setting a cookie through

  1   2   >