Nonblocking keyboard input in python Idle windows

2009-01-21 Thread AON LAZIO
Hi, I want to solve the problem like this running on Idle python windows The problem: the program continue printing 1,2,3,4,5 until it receives the input 'enter' from keyboard then it stops printing this could be done using msvcrt.kbhit() and msvcrt.getch() on command prompt

Start Python at client side from web app

2009-01-21 Thread Thomas Guettler
Hi, I want to start Python at the client side from a web application. The app is an intranet application, and all client PCs are under our control (we can install software on them). But I don't want to update the installation too often. Here is my idea: We create a custom mime-type and register

Re: English-like Python

2009-01-21 Thread Steven D'Aprano
On Tue, 20 Jan 2009 11:58:46 -0700, Joe Strout wrote: > Aaron Brady wrote: > >> I think it would be a good step if you could make some sensible >> interpretation of a typical statement without its parentheses. >> >> f "abc" 123 >> --> >> f( "abc", 123 ) >> >> It would be just the thing in a cou

Re: Start Python at client side from web app

2009-01-21 Thread Lars Behrens
Thomas Guettler wrote: > But I don't want to update the installation too often. Here is my idea: > > We create a custom mime-type and register it on the client PC. The web > application can send signed python code to the client PC. If the signature > is correct, the code will be executed at the c

Re: English-like Python

2009-01-21 Thread Aaron Brady
On Jan 20, 9:16 pm, MRAB wrote: > Terry Reedy wrote: > > Joe Strout wrote: > >> Aaron Brady wrote: > > >>> I think it would be a good step if you could make some sensible > >>> interpretation of a typical statement without its parentheses. > > >>> f "abc" 123 > >>> --> > >>> f( "abc", 123 ) > > >

Re: How to get first/last day of the previous month?

2009-01-21 Thread M.-A. Lemburg
On 2009-01-20 15:54, Mike Driscoll wrote: > On Jan 20, 8:19 am, Hussein B wrote: >> Hey, >> I'm creating a report that is supposed to harvest the data for the >> previous month. >> So I need a way to get the first day and the last day of the previous >> month. >> Would you please tell me how to do

Re: English-like Python

2009-01-21 Thread Aaron Brady
On Jan 21, 2:36 am, Steven D'Aprano wrote: > On Tue, 20 Jan 2009 11:58:46 -0700, Joe Strout wrote: > > Aaron Brady wrote: > > >> I think it would be a good step if you could make some sensible > >> interpretation of a typical statement without its parentheses. > > >> f "abc" 123 > >> --> > >> f( "

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

2009-01-21 Thread Aaron Brady
On Jan 17, 11:28 pm, Steven D'Aprano wrote: > On Sat, 17 Jan 2009 20:49:38 +0100, Bruno Desthuilliers wrote: > > Russ P. a écrit : > >> On Jan 15, 12:21 pm, Bruno Desthuilliers > >> wrote: > > >>> Once again, the important point is that there's a *clear* distinction > >>> between interface and im

Locking blockl to a people on a similar group / naming locks

2009-01-21 Thread reyjexter
Hello! Is there a way to lock a certain block to a people on similar group? In java this is done by like this: synchronize (myGroup) { } but how do I do this in python? how can I name the lock that will be used by the thread? -rey -- http://mail.python.org/mailman/listinfo/python-list

Re: Start Python at client side from web app

2009-01-21 Thread Paul Rubin
Thomas Guettler writes: > I want to start Python at the client side from a web > application. The app is an intranet application, and all client PCs > are under our control (we can install software on them). Is it supposed to be OS independent? If not, is it for a specific OS? Which one? -- http

Re: Locking blockl to a people on a similar group / naming locks

2009-01-21 Thread Paul Rubin
reyjexter writes: > synchronize (myGroup) { > } > > but how do I do this in python? how can I name the lock that will be > used by the thread? You have to do it explicitly, for example with RLock: myInstance.lock = RLock() ... myInstance.lock.acquire() ... critical section ...

Re: reading file to list

2009-01-21 Thread Xah Lee
Rhodri James wrote: > I recommend spending less time being certain that you are correct > without seeking evidence I don't concur. For instance, when you are talking to a bunch of kids, you have to be sure of yourself, else they run all over you, even if they didn't mean to be rude. Also, one's

Re: reading file to list

2009-01-21 Thread Lars Behrens
Rhodri James wrote: > I *was* thinking of code produced in the real world, and I don't buy > your assertion. I'm not an academic, and I wouldn't hesitate to lay > down a line of code like that. As I said before, it fits into English > language idioms naturally, and as a result is pretty self-des

Re: reading file to list

2009-01-21 Thread Lars Behrens
Lars Behrens wrote: > As a non-native speaker and non-academic, I don't understand the "fittine "fitting", I meant. Sorry ^^ -- Cheerz Lars -- http://mail.python.org/mailman/listinfo/python-list

Re: smtplib.SMTP throw : 'Socket error: 10053 software caused connection abort'

2009-01-21 Thread aberry
aberry wrote: > > I am using 'smtplib' module to send an email but getting exception... > > smtplib.SMTP( throw error : > > here is trace back snippet :- > > " smtp = smtplib.SMTP(self.server) > File "D:\Python24\lib\smtplib.py", line 244, in __init__ >(code, msg) = self.connect(host,

Re: Locking blockl to a people on a similar group / naming locks

2009-01-21 Thread Diez B. Roggisch
Paul Rubin wrote: > reyjexter writes: >> synchronize (myGroup) { >> } >> >> but how do I do this in python? how can I name the lock that will be >> used by the thread? > > You have to do it explicitly, for example with RLock: > > myInstance.lock = RLock() > ... > myInstance.lock.ac

Re: Logging help

2009-01-21 Thread Vinay Sajip
On Jan 20, 10:11 am, koranthala wrote: > > The doRollover method does not append to the earlier file. Rather, it > creates a new file with the same name. Err... that's what rollover means - switching to a new log file (and renaming the old ones). If it just appended to the old one, why would it b

Re: Start Python at client side from web app

2009-01-21 Thread 7stud
On Jan 21, 1:10 am, Thomas Guettler wrote: > Hi, > > I want to start Python at the client side from a web application. The > app is an intranet application, and all client PCs are under our control (we > can install software on them). > > But I don't want to update the installation too often. Here

Re: Locking blockl to a people on a similar group / naming locks

2009-01-21 Thread Paul Rubin
"Diez B. Roggisch" writes: > In python 2.5 and upwards, you can write this safer > from __future__ import with_statement # only needed for py2.5 > with myInstance.lock: >... critical section Good point! -- http://mail.python.org/mailman/listinfo/python-list

Re: Start Python at client side from web app

2009-01-21 Thread James Stroud
Thomas Guettler wrote: Hi, I want to start Python at the client side from a web application. The app is an intranet application, and all client PCs are under our control (we can install software on them). But I don't want to update the installation too often. Here is my idea: We create a custo

Re: Start Python at client side from web app

2009-01-21 Thread Diez B. Roggisch
James Stroud wrote: > Thomas Guettler wrote: >> Hi, >> >> I want to start Python at the client side from a web application. The >> app is an intranet application, and all client PCs are under our control >> (we can install software on them). >> >> But I don't want to update the installation too

Re: what's the point of rpython?

2009-01-21 Thread Paul Rubin
Brendan Miller writes: > I'm curious about that. I've been looking around for timing > information on the lock signal, but am having some trouble finding > them. Intuitively, given that the processor is much faster than the > bus, and you are just waiting for processor to complete an addition or >

Re: Start Python at client side from web app

2009-01-21 Thread Thomas Guettler
Sorry, I described my problem not well. Here is more information: The main application is the intranet web application used with IE (ms windows client). But some action needs to be done on the client since you can't do it with html or javascript. 1. The user pushes a button in the web app. 2. W

Re: Start Python at client side from web app

2009-01-21 Thread Diez B. Roggisch
Thomas Guettler wrote: > Sorry, I described my problem not well. Here is more information: > > The main application is the intranet web application used with IE (ms > windows client). But some action needs to be done on the client since you > can't do it with html or javascript. > > 1. The user

Re: what's the point of rpython?

2009-01-21 Thread skip
Brendan> Intuitively, given that the processor is much Brendan> faster than the bus, and you are just waiting for processor to Brendan> complete an addition or comparison before put the new memory Brendan> value on the bus... I think in Python's case the reference count will often

Re: frequency analysis without numpy

2009-01-21 Thread sturlamolden
On Jan 21, 12:13 am, sturlamolden wrote: > Apart from that, an FFT in pure python is going to be atrociously slow > for anything but the shortest signals. I cannot imagine why you want > to do this. Just to elaborate on this: The whole purpose of using FFT is speed. That pretty much excludes th

os.path.getmtime on windows, error: 206 - path or extension too long

2009-01-21 Thread mynthon
I have very long path on windows and i get error when try to get modification time. So i tried do chdir path and then get file. It now gives me error that file doesn't exists # code def getmtimeWIN32(p): mycwd = os.getcwd() if p.startswith('?\\'): p = p.replace('?\\', '',

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

2009-01-21 Thread Bruno Desthuilliers
Russ P. a écrit : (snip) In any case, I have suggested that Python should perhaps get a new keyword, "private" or "priv". And quite a few people - most of them using Python daily - answered they didn't wan't it. -- http://mail.python.org/mailman/listinfo/python-list

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

2009-01-21 Thread Bruno Desthuilliers
Russ P. a écrit : (snip) Since when is no one is allowed to suggest a potential improvement to a product unless they are willing to implement it themselves? Imagine what the world would be like if such a rule applied to all products. There are two points here. The first one is whether what you

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

2009-01-21 Thread Bruno Desthuilliers
Russ P. a écrit : (snip) Your mistake for being a moron. But it seems to happen regularly, doesn't it. How much more of my time are you going to waste, loser? Calling people names is certainly not the best way to defend your opinions here. Adios, Mr. P. -- http://mail.python.org/mailman/listi

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

2009-01-21 Thread Tim Rowe
2009/1/21 Paul Rubin <"http://phr.cx"@nospam.invalid>: > I have no direct experience with it but have read a little about it. > It looks to be a fairly vanilla block structured imperative language > like Pascal with some concurrency stuff added. The sense I have is > that it's not especially hard

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

2009-01-21 Thread Bruno Desthuilliers
Paul Rubin a écrit : Bruno Desthuilliers writes: Zope is about 375 KLOC[1], How many LOCS would it require if it was written in ADA ? No idea. Ada is a lot more verbose than Python, but I'm baffled at what the heck Zope is actually doing with all that code. Zope also has 275 open bugs, 6

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

2009-01-21 Thread Mark Wooding
"Russ P." writes: > Which is why I was hoping that Python might get enforced data hiding > as well as optional static type declarations that can actually be used > for static verification. But maybe that's all just a pipe dream on my > part -- or "onanism." I think that, if you want static assur

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

2009-01-21 Thread Mark Wooding
"Russ P." writes: > I'm not sure what you mean by "conflating module and class systems." > Are you referring to the fact that Java requires each class to be in > its own file of the same name (I don't use Java, but that's what I've > heard)? If so, I agree that is a bad idea. No. I mean that us

Re: os.path.getmtime on windows, error: 206 - path or extension too long

2009-01-21 Thread mynthon
On Jan 21, 11:50 am, mynthon wrote: > I have very long path on windows and i get error when try to get > modification time. So i tried do chdir path and then get file. It now > gives me error that file doesn't exists > > # code > def getmtimeWIN32(p): >     mycwd = os.getcwd() > >     if p.startsw

Re: How to print lambda result ?

2009-01-21 Thread Steve Holden
Because your print statement defines the lambda without calling it. regards Steve Barak, Ron wrote: > Thanks Tino: your solutions without the lambda work nicely. > What I still don't understand is why the print does not execute the lambda > and prints the result, instead of printing the lambda'

Re: Problem with 3.0 Install on Windows

2009-01-21 Thread Steve Holden
Saul Spatz wrote: > I'm running python 2.5.x on Windows XP, and I installed 3.0, just to get > familiar with it. I have a directory with all my python projects in my > PYTHONPATH variable. When I try to run python 3.0, it detects a syntax > error (a print statement) in the first file in this dire

Re: How to write a simple shell loop in python?

2009-01-21 Thread Steve Holden
Dietrich Bollmann wrote: > Hi, > > I am trying to write a simple shell loop in Python. > > My simple approach works fine - but the first output line after entering > something is always indented by one blank. > > Is there any logic explanation for this? > How can I get rid of the blank? > Is

Re: reading file to list

2009-01-21 Thread Steve Holden
Xah Lee wrote: > On Jan 19, 11:17 pm, alex23 wrote: > ... [...] > sure. In a political context, many criticism or description of the > situation from one party can be seen as ad hominem attack. I feel that > that many old emacs users, which includes significant portion of emacs > developers (if no

Re: os.path.getmtime on windows, error: 206 - path or extension too long

2009-01-21 Thread mynthon
On Jan 21, 2:13 pm, mynthon wrote: > On Jan 21, 11:50 am, mynthon wrote: > > > > > I have very long path on windows and i get error when try to get > > modification time. So i tried do chdir path and then get file. It now > > gives me error that file doesn't exists > > > # code > > def getmtimeWI

Re: os.path.getmtime on windows, error: 206 - path or extension too long

2009-01-21 Thread mynthon
On Jan 21, 2:58 pm, mynthon wrote: > On Jan 21, 2:13 pm, mynthon wrote: > > > > > On Jan 21, 11:50 am, mynthon wrote: > > > > I have very long path on windows and i get error when try to get > > > modification time. So i tried do chdir path and then get file. It now > > > gives me error that fil

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

2009-01-21 Thread Duncan Booth
Terry Reedy wrote: > Delaney, Timothy (Tim) wrote: >> Terry Reedy wrote: >> The compiled code differs. >>> I *strongly* doubt that. Properties are designed to be transparent to >>> user code that access atrributes through the usual dotted name >>> notation precisely so that class code can

Re: English-like Python

2009-01-21 Thread Joe Strout
Steven D'Aprano wrote: LogError "Walk has gotten too silly", CurrentTime Here, LogError is a method call that takes two arguments, and CurrentTime is a method call that takes none. That seems ambiguous to me. As a non-RealBasic programmer, I can see at least four meanings it could have. Tr

Re: Python 3.0 urllib.parse.parse_qs results in TypeError

2009-01-21 Thread Aahz
In article <313a27f9-c655-4fc4-a8e3-568a4283b...@f40g2000pri.googlegroups.com>, ag73 wrote: > > form = urllib.parse.parse_qs(qs, keep_blank_values=1) > >However, the last line of code that calls parse_qs causes the >following exception to be thrown: > > >Type str doesn't sup

Re: 'Import sys' succeeds in C++ embedded code, but module is not fully visible

2009-01-21 Thread Aahz
In article , Ben Sizer wrote: > >I have the following C++ code and am attempting to embed Python 2.5, >but although the "import sys" statement works, attempting to reference >"sys.path" from inside a function after that point fails. It's as if >it's not treating it as a normal module but as any o

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

2009-01-21 Thread MRAB
Russ P. wrote: On Jan 20, 10:02 pm, alex23 wrote: Can I comprehend that you don't even have an immediate need and are instead actively engaging in online onanism? Absolutely. So anyone thinking beyond an "immediate need" is "engaging in online onanism"? That doesn't mean what you think it

Re: English-like Python

2009-01-21 Thread Joe Strout
Aaron Brady wrote: Where functions are first-class objects, a bare function object isn't distinguishable either from its call. That depends not on whether functions are first-class objects, but on the *syntax* of function invocation vs. function reference. It just so happens than in Python,

is this pythonic?

2009-01-21 Thread TP
Hi, 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 data in the list of dictionaries l, because in my applica

Re: Importing modules

2009-01-21 Thread Mudcat
This is something I've wondered about for a while. I know that theoretically Python is supposed to auto-recognize duplicate imports; however I've run into problems in the past if I didn't arrange the imports in a certain way across multiple files. As a result, I worry about conflicts that arise bec

quick beginners List comprehension question

2009-01-21 Thread Dr Mephesto
Hi, Im new to python, and OOP, and am trying to get a handle on list comprehension. Say I have a class Foo with a property called bar: class Foo: def __init__(self): self.bar = random.randint(1,100) and then I make a list of these objects: Newlist = [] for x in range(10): Newlis

Re: quick beginners List comprehension question

2009-01-21 Thread Diez B. Roggisch
Dr Mephesto wrote: > Hi, > Im new to python, and OOP, and am trying to get a handle on list > comprehension. > > Say I have a class Foo with a property called bar: > > class Foo: > def __init__(self): > self.bar = random.randint(1,100) > > and then I make a list of these objects: >

Re: quick beginners List comprehension question

2009-01-21 Thread MRAB
Dr Mephesto wrote: Hi, Im new to python, and OOP, and am trying to get a handle on list comprehension. Say I have a class Foo with a property called bar: class Foo: def __init__(self): self.bar = random.randint(1,100) and then I make a list of these objects: Newlist = [] for x in

Re: quick beginners List comprehension question

2009-01-21 Thread Philip Semanchuk
On Jan 21, 2009, at 10:52 AM, Dr Mephesto wrote: Hi, Im new to python, and OOP, and am trying to get a handle on list comprehension. Say I have a class Foo with a property called bar: class Foo: def __init__(self): self.bar = random.randint(1,100) and then I make a list of these ob

Re: what's the point of rpython?

2009-01-21 Thread Scott David Daniels
Brendan Miller wrote: On Tue, Jan 20, 2009 at 10:03 PM, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: Of course I'm aware of the LOCK prefix but it slows down the instruction enormously compared with a non-locked instruction. I'm curious about that. I've been looking around for timi

Re: Importing modules

2009-01-21 Thread Marco Mariani
Mudcat wrote: This is something I've wondered about for a while. I know that theoretically Python is supposed to auto-recognize duplicate imports; however I've run into problems in the past if I didn't arrange the imports in a certain way across multiple files. I think you've probably had issu

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: quick beginners List comprehension question

2009-01-21 Thread MRAB
Diez B. Roggisch wrote: Dr Mephesto wrote: Hi, Im new to python, and OOP, and am trying to get a handle on list comprehension. Say I have a class Foo with a property called bar: class Foo: def __init__(self): self.bar = random.randint(1,100) and then I make a list of these object

Re: How to write a simple shell loop in python?

2009-01-21 Thread Scott David Daniels
Dietrich Bollmann wrote: I am trying to write a simple shell loop in Python. My simple approach works fine - but the first output line after entering something is always indented by one blank. Is there any logic explanation for this? Yes How can I get rid of the blank? By not asking for i

Beating a Timeout

2009-01-21 Thread K-Dawg
Hi, I am trying to write a python script that I can run to prevent a timeout of webpage. I have to use a system at work that keeps track of issues. I use this a couple of time an hour and it times out after 10 minutes. The system is really crummy and it rejects your username and password about

Re: quick beginners List comprehension question

2009-01-21 Thread Lou Pecora
In article , Philip Semanchuk wrote: > > Other answers have been good; to them I'll add the comment that list > comprehensions are for *constructing* lists, not manipulating the > elements thereof. > > HTH > Philip Well this seems to work just fine. What am I missing: A=[1,2,3] p

Re: frequency analysis without numpy

2009-01-21 Thread philbru
On Jan 20, 3:13 pm, sturlamolden wrote: > Consider using Thompson's multitaper method, autoregression (maximum > entropy), or Welch method for your frequency estimates. Blackman- > Tuckey is also a possibility, but I see no reason to prefer that to > Welch. Multitaper and AR tends to be the better

Re: is this pythonic?

2009-01-21 Thread alex23
On Jan 22, 1:16 am, 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}] Try not to use 'dict' or the name of any of t

Re: quick beginners List comprehension question

2009-01-21 Thread Steve Holden
Lou Pecora wrote: > In article , > Philip Semanchuk wrote: > >> Other answers have been good; to them I'll add the comment that list >> comprehensions are for *constructing* lists, not manipulating the >> elements thereof. >> >> HTH >> Philip > > > Well this seems to work just fine. What

Re: Beating a Timeout

2009-01-21 Thread K-Dawg
Also, the actual JS code that does this simply uses a window.location.reload() to keep the session active. So I guess the only thing could be that eash urllib.urlopen call is seen as a new session? How can I make it part of the same session I am using in IE? Or am I a hundred miles off? Thank

Re: quick beginners List comprehension question

2009-01-21 Thread Philip Semanchuk
On Jan 21, 2009, at 11:52 AM, Lou Pecora wrote: In article , Philip Semanchuk wrote: Other answers have been good; to them I'll add the comment that list comprehensions are for *constructing* lists, not manipulating the elements thereof. HTH Philip Well this seems to work just fine. Wh

Re: is this pythonic?

2009-01-21 Thread MRAB
alex23 wrote: On Jan 22, 1:16 am, 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}] Try not to use 'dict' or the name of any of the other

Re: Beating a Timeout

2009-01-21 Thread MRAB
K-Dawg wrote: Hi, I am trying to write a python script that I can run to prevent a timeout of webpage. I have to use a system at work that keeps track of issues. I use this a couple of time an hour and it times out after 10 minutes. The system is really crummy and it rejects your username

Re: Importing modules

2009-01-21 Thread alex23
On Jan 22, 1:45 am, Mudcat wrote: > This is something I've wondered about for a while. I know that > theoretically Python is supposed to auto-recognize duplicate imports; > however I've run into problems in the past if I didn't arrange the > imports in a certain way across multiple files. As a res

Re: is this pythonic?

2009-01-21 Thread TP
alex23 wrote: > Try not to use 'dict' or the name of any of the other built-in types > as labels. Ops... Moreover I know it... > You're stepping through an entire list just to pass another list to > l.remove to step through and remove items from...in fact, given that > list.remove deletes th

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

2009-01-21 Thread Luis Zarrabeitia
On Wednesday 21 January 2009 02:30:54 am Russ P. wrote: > That could work. As long as it's well-engineered (not a hack), well- > supported (part of the standard library), and does the job, that's > probably all that matters. But you keep failing to explay why do you need it to be _part of the sta

Re: Beating a Timeout

2009-01-21 Thread K-Dawg
Sorry about the last mesasge, I accidentally replied directly to the poster. So I now have: br = mechanize.Browser() br.open("theURL") while True: result = br.reload() print result print "Retrieved Page" time.sleep(300) But it still does not appear to be working... Shortly after I got the

Re: is this pythonic?

2009-01-21 Thread alex23
On Jan 22, 3:27 am, MRAB wrote: > FYI, you shouldn't modify a list you're iterating over. But I'm not. I'm building a new list and binding it to the same name as the original, which works perfectly fine (unless I'm missing something): >>> l = range(100) >>> l = [d for d in l if not d % 5] >>> l

Python 2.4 vs 2.5 - Unicode error

2009-01-21 Thread Gaurav Veda
Hi, I am trying to put some webpages into a mysql database using python (after some processing on the text). If I use Python 2.4.2, it works without a fuss. However, on Python 2.5, I get the following error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 4357: ordinal not in

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

2009-01-21 Thread Luis Zarrabeitia
On Tuesday 20 January 2009 09:52:01 pm Paul Rubin wrote: > Luis Zarrabeitia writes: > > > Whaat? Assuming a program is perfect unless a failure is proven > > > is not at all a sane approach to getting reliable software. It is > > > the person claiming perfection who has to prove the absence of f

Re: is this pythonic?

2009-01-21 Thread MRAB
alex23 wrote: On Jan 22, 3:27 am, MRAB wrote: FYI, you shouldn't modify a list you're iterating over. But I'm not. I'm building a new list and binding it to the same name as the original, which works perfectly fine (unless I'm missing something): [snip] I was referring to the code: for

Re: is this pythonic?

2009-01-21 Thread alex23
On Jan 22, 3:34 am, TP wrote: > >     for index, record in enumerate(l): > >         if record['title'] == 'ti': > >             l.pop(index) > > Ok, I will use this solution. But it is less pythonic than list > comprehensions. Are you asking if it's less pythonic, or asserting? Because you'll fi

Re: pep 8 constants

2009-01-21 Thread Aahz
In article , Brendan Miller wrote: > >PEP 8 doesn't mention anything about using all caps to indicate a constant. > >Is all caps meaning "don't reassign this var" a strong enough >convention to not be considered violating good python style? I see a >lot of people using it, but I also see a lot of

Re: Importing modules

2009-01-21 Thread Mudcat
> I think you've probably had issues with circular imports (i.e. mutual > dependencies), unless you can precisely remember what you were doing and > what went wrong. That's possible, but circular imports become more of a hazard if you have to import in several locations. Unify that to one file, an

Re: Mathematica 7 compares to other languages

2009-01-21 Thread soul.mirr...@gmail.com
On Dec 4 2008, 5:11 am, Andreas Waldenburger wrote: > On Wed, 03 Dec 2008 20:38:44 -0500 Lew wrote: > > > Xah Lee wrote: > > > enough babble ... > > > Good point.  Plonk.  Guun dun! > > I vaguely remember you plonking the guy before. Did you unplonk him in > the meantime? Or was that just a figur

Re: is this pythonic?

2009-01-21 Thread alex23
On Jan 22, 3:56 am, MRAB wrote: > I was referring to the code: > >      for index, record in enumerate(l): >          if record['title'] == 'ti': >              l.pop(index) > > where you are enumerating and iterating over 'l', but also modifying 'l' > with 'l.pop(index)'. Ack, you're absolutely

Re: Importing modules

2009-01-21 Thread Mudcat
On Jan 21, 11:29 am, alex23 wrote: > Well, you can always stick those imports into a 'common.py' and do > 'from common import *' in each file that uses them. But doing so can > be a pain to maintain and debug for anything more than the most simple > of applications. Being able to see a module's d

[ANN] Python FTP Server library (pyftpdlib) 0.5.1 released

2009-01-21 Thread Giampaolo Rodola'
Hi, I'm pleased to announce release 0.5.1 of Python FTP Server library (pyftpdlib). http://code.google.com/p/pyftpdlib === About === Python FTP server library provides an high-level portable interface to easily write asynchronous FTP servers with Python. Based on asyncore framework pyftpdlib is c

Re: what's the point of rpython?

2009-01-21 Thread Brendan Miller
On Wed, Jan 21, 2009 at 8:19 AM, Scott David Daniels wrote: > Brendan Miller wrote: >> >> On Tue, Jan 20, 2009 at 10:03 PM, Paul Rubin >> <"http://phr.cx"@nospam.invalid> wrote: >>> >>> Of course I'm aware of the LOCK prefix but it slows >>> down the instruction enormously compared with a no

Trouble writing txt

2009-01-21 Thread bilgin arslan
Hello, I am trying to write a list of words to into a text file as two colons: word (tab) len(word) such as standart8 I have no trouble writing the words but I couldn't write integers. I always get strange characters, such as: GUN 㐊娀䄀䴀䄀一ഀ਀5COCUK 㐊䬀䄀䐀䤀一ഀ਀5EV ... 㜊夀䄀䴀䄀ഀ਀4YATSI 㔊娀䤀䰀䜀䤀吀ഀ਀� (the

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

2009-01-21 Thread Paul Rubin
Luis Zarrabeitia writes: > But somehow the discussion shifted from an optional requirement (giving you > the chance to explicitly use 'from lock import unlock; o = unlock(obj)') > to "it can't be done _ever_" (using setattr/getattr is as explicit as your > analogous 'unlock' function). The id

Re: is this pythonic?

2009-01-21 Thread pruebauno
On Jan 21, 12:34 pm, TP wrote: > alex23 wrote: > > Try not to use 'dict' or the name of any of the other built-in types > > So my list is rather: > l=[{"title":"to", "color":"blue", "value":2} > {"title":"ti", "color":"red", "value":"coucou"}] > > So, I will rather use your solution: > > for index

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

2009-01-21 Thread ak
On Jan 20, 1:14 am, Steven D'Aprano wrote: > 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 > > >

progress: compiling python2.5 under msys (specifically but not exclusively under wine) with msvcr80

2009-01-21 Thread Luke Kenneth Casson Leighton
this is a progress report on compiling python using entirely free software tools, no proprietary compilers or operating systems involved, yet still linking and successfully running with msvcr80 assemblies. manifests and rc files, which are compiled to internal resources, have been added. various s

Re: what's the point of rpython?

2009-01-21 Thread MRAB
Brendan Miller wrote: On Wed, Jan 21, 2009 at 8:19 AM, Scott David Daniels wrote: Brendan Miller wrote: On Tue, Jan 20, 2009 at 10:03 PM, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: Of course I'm aware of the LOCK prefix but it slows down the instruction enormously compared with

Re: progress: compiling python2.5 under msys (specifically but not exclusively under wine) with msvcr80

2009-01-21 Thread Luke Kenneth Casson Leighton
> http://bugs.python.org/issue5010 correction: that's http://bugs.python.org/issue5026 apologies for the mix-up. also,for the msvcrt80 build, it is _essential_ that you use a patched version of mingw32-runtime, see: https://sourceforge.net/tracker/index.php?func=detail&aid=2134161&group_id=2435&a

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

2009-01-21 Thread Luis Zarrabeitia
On Wednesday 21 January 2009 02:03:07 pm Paul Rubin wrote: > Luis Zarrabeitia writes: > > But somehow the discussion shifted from an optional requirement (giving > > you the chance to explicitly use 'from lock import unlock; o = > > unlock(obj)') to "it can't be done _ever_" (using setattr/getattr

date format

2009-01-21 Thread Ahmed, Shakir
I am grabbing few fields from a table and one of the columns is in date format. The output which I am getting is "Wed Feb 09 00:00:00 2005" but the data in that column is "02/09/2005" and I need the same format output to insert those recodes into another table. print my_service_DATE Wed Feb 09 00:

Re: date format

2009-01-21 Thread Tim Chase
Ahmed, Shakir wrote: I am grabbing few fields from a table and one of the columns is in date format. The output which I am getting is "Wed Feb 09 00:00:00 2005" but the data in that column is "02/09/2005" and I need the same format output to insert those recodes into another table. print my_serv

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

2009-01-21 Thread Scott David Daniels
Mark Wooding wrote: "Russ P." writes: Actually, in addition to the enforcement of "private," you also need the enforcement of "protected." Oh, heavens. If you want C++ or any of its progeny, you know where to find them. Besides, those languages have a horrific design mistake because they c

Re: Trouble writing txt

2009-01-21 Thread Benjamin Kaplan
On Wed, Jan 21, 2009 at 1:59 PM, bilgin arslan wrote: > Hello, > I am trying to write a list of words to into a text file as two > colons: word (tab) len(word) > such as > > standart8 > > I have no trouble writing the words but I couldn't write integers. I > always get strange characters, suc

Re: English-like Python

2009-01-21 Thread Scott David Daniels
Benjamin J. Racine wrote: I think it would be a good step if you could make some sensible interpretation of a typical statement without its parentheses. f "abc" 123 --> f( "abc", 123 ) It would be just the thing in a couple of situations... though it does conflict with raw-string literals as

Re: Python 2.4 vs 2.5 - Unicode error

2009-01-21 Thread John Machin
On Jan 22, 4:49 am, Gaurav Veda wrote: > Hi, > > I am trying to put some webpages into a mysql database using python > (after some processing on the text). If I use Python 2.4.2, it works > without a fuss. However, on Python 2.5, I get the following error: > > UnicodeDecodeError: 'ascii' codec can

Re: Start Python at client side from web app

2009-01-21 Thread James Stroud
Thomas Guettler wrote: Sorry, I described my problem not well. Here is more information: The main application is the intranet web application used with IE (ms windows client). But some action needs to be done on the client since you can't do it with html or javascript. 1. The user pushes a bu

Re: Trouble writing txt

2009-01-21 Thread Jeff McNeil
On Jan 21, 1:59 pm, bilgin arslan wrote: > Hello, > I am trying to write a list of words to into a text file as two > colons: word (tab) len(word) > such as > > standart8 > > I have no trouble writing the words but I couldn't write integers. I > always get strange characters, such as: > > GUN

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

2009-01-21 Thread Russ P.
On Jan 21, 9:34 am, Luis Zarrabeitia wrote: > But you keep failing to explay why do you need it to be _part of the standard_ > library (or whatever). Technically, it doesn't need to be. But if someone proposes using particular language for a major safety-critical project, the critical features r

  1   2   >