Re: English-like Python

2009-01-21 Thread Steven D'Aprano
On Wed, 21 Jan 2009 00:57:49 -0800, Aaron Brady wrote: > Natural language doesn't have the equivalent of parentheses, I take it you mean natural language doesn't have the equivalent of parentheses for *calling*, since NLs can (and do) use parentheses for grouping -- as well as various conventi

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

2009-01-21 Thread Steven D'Aprano
On Wed, 21 Jan 2009 12:54:31 +0100, Bruno Desthuilliers wrote: > 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. Then

USB in python

2009-01-21 Thread Astan Chee
Hi, Im trying to write a program for my USB device and I'm thinking of using python to do this. The USB device is of my own making and it is activated when one of the two data pins of the USB is given about 5V (or similar to whatever the power pin is getting). Now I'm confused to if the softwa

Re: Dictionary : items()

2009-01-21 Thread Terry Reedy
koranthala wrote: Hi, Dictionary has the items method which returns the value as a list of tuples. I was wondering whether it would be a good idea to have an extra parameter - sort - to allow the tuples to be sorted as the desire of users. Currently what I do is: class SDict(dict):

Re: what's the point of rpython?

2009-01-21 Thread Rhamphoryncus
On Jan 21, 9:46 pm, Paul Rubin wrote: > Rhamphoryncus writes: > > a) The contended case is the issue, not the uncontended case.  An > > uncontended lock is just constant overhead, not a barrier to > > scalability > > a1) Really what matters is the actual mix between

Dictionary : items()

2009-01-21 Thread koranthala
Hi, Dictionary has the items method which returns the value as a list of tuples. I was wondering whether it would be a good idea to have an extra parameter - sort - to allow the tuples to be sorted as the desire of users. Currently what I do is: class SDict(dict): def items(self, sort

Re: Logging help

2009-01-21 Thread koranthala
On Jan 21, 2:55 pm, Vinay Sajip wrote: > 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

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

2009-01-21 Thread Paul Rubin
Mark Wooding writes: > Some people (let's call them `type A programmers') have decided that > they want to be assisted with writing correct programs... > Other people (`type B programmers') don't like having their (apparently? > possibly?) correct programs rejected > I think trying to persuade

Re: malloc (error code=12)

2009-01-21 Thread Arash Arfaee
Very BIG Jesse It works on a huge Boolean function. And thanks Roger. Do you think it will be solved if I run it over another OS like windows? Cheers, Arash On Wed, Jan 21, 2009 at 7:19 PM, Jesse Noller wrote: > On Wed, Jan 21, 2009 at 9:38 PM, Arash Arfaee wrote: > > > > Hi All, > > > > I

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. Now it does! See http://www.python.org/dev/peps/pep-0008/ Thanks for bringing this up! -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ Weinberg's

Re: Python 2.4 vs 2.5 - Unicode error

2009-01-21 Thread Wolfgang Rohdewald
On Mittwoch, 21. Januar 2009, Gaurav Veda wrote: > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position > 4357: ordinal not in range(128) > > Before sending the (insert) query to the mysql server, I do the > following which I think should've taken care of this problem: > sqlStr =

Re: what's the point of rpython?

2009-01-21 Thread Paul Rubin
Rhamphoryncus writes: > a) The contended case is the issue, not the uncontended case. An > uncontended lock is just constant overhead, not a barrier to > scalability a1) Really what matters is the actual mix between contended and uncontended accesses, and the synchronization strategy affects the

Re: what's the point of rpython?

2009-01-21 Thread Paul Rubin
Brendan Miller writes: > Actually this article explicitly mentions CMPXCHG as lock free. > http://en.wikipedia.org/wiki/Lock-free_and_wait-free_algorithms I see, that clears up some mysteries. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: reading file to list

2009-01-21 Thread Xah Lee
Rhodri James wrote: > *plonk* Please see: • Killfile Considered Harmful http://xahlee.org/UnixResource_dir/writ/kill_file_harmful.html plain text version follows --- Killfile Considered Harmful Xah Lee, 2000-02-26 In newsgroups, killfile is a playful word meaning that

Re: Overloading Methods

2009-01-21 Thread "
Chris Rebert wrote: On Tue, Jan 20, 2009 at 10:18 AM, MRAB wrote: K-Dawg wrote: Can you overload methods in Python? Can I have multiple __inits__ with different parameters passed in? Simple answer: no. More complicated answer: Yes, with some caveats. You usually don't need to overload me

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

2009-01-21 Thread Terry Reedy
Russ P. wrote: 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 crit

Re: what's the point of rpython?

2009-01-21 Thread Paul Rubin
Ross Ridge writes: > Scott David Daniels wrote: > >The opcode cannot simply talk to its cache, it must either go directly > >to off-chip memory or communicate to other processors that it (and it > >alone) owns the increment target. > The cache coherency mechanism automatically prevents tw

Re: malloc (error code=12)

2009-01-21 Thread Jesse Noller
On Wed, Jan 21, 2009 at 9:38 PM, Arash Arfaee wrote: > > Hi All, > > I am writing a multiprocessing program using python 2.6. It works in most > cases, however when my input is large sometimes I get this message again and > again: > > Python(15492,0xb0103000) malloc: *** mmap(size=393216) failed (

[ANN] The Python Papers Source Codes (Volume 1)

2009-01-21 Thread mauricel...@acm.org
Hi everyone, It has been a few months in the cooking and I'm pleased to announce the publication and ISSN of The Python Papers Source Codes (ISSN 1836-621X). The Python Papers Source Code (TPPSC) will be a collection of code manuscripts, usually with a longer companion manuscript published in The

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

2009-01-21 Thread Paul Rubin
Scott David Daniels writes: > Nowhere in this discussion is a point that I find telling: Python's > policy of accessibility to the full data structure allows simple > implementation of debugging software, rather than the black arcana > that is the normal fare of trying to weld debuggers into the

Re: quick beginners List comprehension question

2009-01-21 Thread Srinivasa NL
You can try this import random class foo: def __init__(self): self.bar = random.randint(1,100) def getbar(ls,i): ls.append(foo()) ls[i].bar = ls[i].bar * 3 ls = [] [getbar(ls,i) for i in range(10)] On Thu, Jan 22, 2009 at 4:45 AM, Diez B. Roggisch wrote: > MRAB schrieb: > >> D

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

2009-01-21 Thread Paul Rubin
Luis Zarrabeitia writes: > Even better. Realize that you are trying to use a tool made for > debugging, documenting, and catching some obvious errors > (private/public) for "security". Go fix Bastion, that would be your > best bet. It was yanked out of python because it was insecure, but > if some

Re: malloc (error code=12)

2009-01-21 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Arash Arfaee wrote: > Python(15492,0xb0103000) malloc: *** mmap(size=393216) failed (error > code=12) errno 12 is ENOMEM on Macs (and Linux for that matter). You may have run out of swap space, but that is unlikely. The most likely cause is that you

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

2009-01-21 Thread Paul Rubin
Bruno Desthuilliers writes: > > In my limited experience with > > Haskell (statically typed but very high level), > > "dynamic" and "static" were not meant to concern typing here (or at > least not only typing). I'm not sure what you mean by those terms then. > Haskell and MLs are indeed stati

malloc (error code=12)

2009-01-21 Thread Arash Arfaee
Hi All, I am writing a multiprocessing program using python 2.6. It works in most cases, however when my input is large sometimes I get this message again and again: Python(15492,0xb0103000) malloc: *** mmap(size=393216) failed (error code=12) *** error: can't allocate region and at the and I ha

Re: Start Python at client side from web app

2009-01-21 Thread Paul Rubin
Thomas Guettler writes: > 1. The user pushes a button in the web app. > 2. Webserver sends signed python code to the client with own mime type > 3. IE sends code to the python application. > 4. Signature gets checked, Python code on the client gets executed. > 5. Maybe send some data to the server

Re: reading file to list

2009-01-21 Thread Rhodri James
On Wed, 21 Jan 2009 09:13:03 -, Xah Lee wrote: 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 yo

Re: reading file to list

2009-01-21 Thread Rhodri James
On Wed, 21 Jan 2009 09:42:19 -, Lars Behrens wrote: 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 langua

Re: list subsetting

2009-01-21 Thread James Mills
On Thu, Jan 22, 2009 at 11:35 AM, blueiur wrote: > i think it's best way > lst = [0, 1, 3.14, 20, 8, 8, 3.14] > len( filter(lambda x: x > 3.13 and x < 3.15, lst) ) > 2 I prefer this way (cleaner): >>> lst = [0, 1, 3.14, 20, 8, 8, 3.14] >>> len([x for x in lst if 3.13 < x < 3.15]) 2 >>> cheers J

Re: list subsetting

2009-01-21 Thread blueiur
i think it's best way lst = [0, 1, 3.14, 20, 8, 8, 3.14] len( filter(lambda x: x > 3.13 and x < 3.15, lst) ) 2 On 1월22일, 오전6시53분, culpritNr1 wrote: > Hello All, > > Say I have a list like this: > > a = [0 , 1, 3.14, 20, 8, 8, 3.14] > > Is there a simple python way to count the number of 3.14's

Mechanize hanging

2009-01-21 Thread K-Dawg
Hi, I am trying to use mechanize to connect and log into Yahoo! Here is my code: #c:\Python25\python import re import urllib import urllib2 import mechanize print "print1" br = mechanize.Browser() br.set_handle_robots(False) br.open("https://login.yahoo.com/config/login?";) It is hanging at th

Re: frequency analysis without numpy

2009-01-21 Thread debug
On Jan 21, 11:31 am, sturlamolden wrote: > 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 pu

Re: Cannot contact Python webmaster!

2009-01-21 Thread skip
>> Does anybody know how to get in touch with the www.python.org website >> maintainers? i sent mail to webmas...@python.org but it just bounces >> back. Is anybody even there? :) The webmaster address should work. Lots of people send mail to it. What is the error message in the bou

Re: Start Python at client side from web app

2009-01-21 Thread Bryan Olson
Thomas Guettler wrote: Sorry, I described my problem not well. Here is more information: Actually you did pretty well. [...] The main application is the intranet web application used with IE (ms windows client). Your idea of a custom mime-type, with a browser extension, should work. I don

Re: list subsetting

2009-01-21 Thread MRAB
culpritNr1 wrote: Thank you Fogelbird and Jeff. I actually tried to find out if such function existed. I did help("count") no Python documentation found for 'count' [snip] 'count' is a method of the list class, so you need: help(list.count) and if you want help on the list class then it's

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

2009-01-21 Thread Mark Wooding
Luis Zarrabeitia writes: > Btw, the correctness of a program (on a turing-complete language) > cannot be statically proven. Ask Turing about it. Be careful! Given a putative correctness-checking algorithm, there exist programs for which the algorithm gives the wrong answer. That doesn't necess

Re: Python 2.4 vs 2.5 - Unicode error

2009-01-21 Thread John Machin
On Jan 22, 9:50 am, Gaurav Veda wrote: > > The 0xc2 strongly suggests that you are feeding the beast data encoded > > in UTF-8 while giving it no reason to believe that it is in fact not > > encoded in ASCII. Curiously the first errant byte is a long way (4KB) > > into your data. Consider doing >

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

2009-01-21 Thread Mark Wooding
Scott David Daniels writes: > Nowhere in this discussion is a point that I find telling: Python's > policy of accessibility to the full data structure allows simple > implementation of debugging software, rather than the black arcana > that is the normal fare of trying to weld debuggers into the

Re: Start Python at client side from web app

2009-01-21 Thread Rob Williscroft
Diez B. Roggisch wrote in news:6tpo16fbacf...@mid.uni-berlin.de in comp.lang.python: > >> 2) create a localhost web server, for the client side manipulation. >> Then have your remote webserver render a form that posts via >> javavscript to the localhost webserver. The localhost server would >>

Re: quick beginners List comprehension question

2009-01-21 Thread Diez B. Roggisch
MRAB schrieb: 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

Re: Start Python at client side from web app

2009-01-21 Thread Diez B. Roggisch
2) create a localhost web server, for the client side manipulation. Then have your remote webserver render a form that posts via javavscript to the localhost webserver. The localhost server would post back in the same way. AFAIK the JS security model prevents that. Diez -- http://mail.pyth

Re: Start Python at client side from web app

2009-01-21 Thread Rob Williscroft
Thomas Guettler wrote in news:6toehtfbrb8...@mid.individual.net in comp.lang.python: > 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 sin

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

2009-01-21 Thread Roumen Petrov
Terry Reedy wrote: Luke Kenneth Casson Leighton wrote: i look forward to seeing the same incremental improvement applied to the development of python, evidence of which would be clearly seen by the acceptance of one of the following patches, one of which is dated 2003: http://bugs.python.org

Re: Python 2.4 vs 2.5 - Unicode error

2009-01-21 Thread Gaurav Veda
> The 0xc2 strongly suggests that you are feeding the beast data encoded > in UTF-8 while giving it no reason to believe that it is in fact not > encoded in ASCII. Curiously the first errant byte is a long way (4KB) > into your data. Consider doing > print repr(data) > to see what you've actual

RE: spam on the list - how are things now?

2009-01-21 Thread Delaney, Timothy (Tim)
s...@pobox.com wrote: > We've been running SpamBayes on the news-to-mail gateway on > mail.python.org for a couple weeks now. To me it seems like the > level of spam leaking onto the list has dropped way down but I'd like > some feedback from people who read the python-list@python.org mailing > l

Re: list subsetting

2009-01-21 Thread FogleBird
On Jan 21, 5:22 pm, culpritNr1 wrote: > Thank you Fogelbird and Jeff. > > I actually tried to find out if such function existed. I did > > >>> help("count") > > no Python documentation found for 'count' > > Anyway. More than counting, I am interested in list subsetting in a simple > way. Forget ab

Re: list subsetting

2009-01-21 Thread Robert Kern
culpritNr1 wrote: Thank you Fogelbird and Jeff. I actually tried to find out if such function existed. I did help("count") no Python documentation found for 'count' Anyway. More than counting, I am interested in list subsetting in a simple way. Forget about counting. Say I have a list of lis

Re: list subsetting

2009-01-21 Thread Paul Rubin
culpritNr1 writes: > Anyway. More than counting, I am interested in list subsetting in a simple > way. Forget about counting. Say I have a list of lists and I want to pull > only the rows where the second "column" equals 3.14. list_of_lists = [[1.414,2.718,3.14],[4.00,3.14,1.618],[72,29,39]] thos

Re: what's the point of rpython?

2009-01-21 Thread Rhamphoryncus
On Jan 21, 12:57 pm, MRAB wrote: > I'm not sure whether multicore processors share a cache or, if not, have > some other on-chip mechanism. Multiprocessor machines, however, are a > different matter... They share some, but also have some exclusive. How much of which depends entirely on which CPU

Re: list subsetting

2009-01-21 Thread culpritNr1
Thank you Fogelbird and Jeff. I actually tried to find out if such function existed. I did >>> help("count") no Python documentation found for 'count' Anyway. More than counting, I am interested in list subsetting in a simple way. Forget about counting. Say I have a list of lists and I want to

Re: list subsetting

2009-01-21 Thread Jervis Whitley
On Thu, Jan 22, 2009 at 9:09 AM, Jeff McNeil wrote: > On Jan 21, 4:53 pm, culpritNr1 wrote: > > Hello All, > > > > Say I have a list like this: > > > > a = [0 , 1, 3.14, 20, 8, 8, 3.14] > > > > Is there a simple python way to count the number of 3.14's in the list in > > one statement? > > > > I

Re: list subsetting

2009-01-21 Thread Paul Rubin
culpritNr1 writes: > a = [0 , 1, 3.14, 20, 8, 8, 3.14] > > Is there a simple python way to count the number of 3.14's in the list in > one statement? n = sum(1 for x in a if x == 3.14) -- http://mail.python.org/mailman/listinfo/python-list

Re: English-like Python

2009-01-21 Thread Aaron Brady
On Jan 21, 2:50 pm, Scott David Daniels wrote: > 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 cou

Re: list subsetting

2009-01-21 Thread Rob Williscroft
culpritNr1 wrote in news:mailman.7713.1232574803.3487.python-l...@python.org in comp.lang.python: > > Hello All, > > Say I have a list like this: > > a = [0 , 1, 3.14, 20, 8, 8, 3.14] > > Is there a simple python way to count the number of 3.14's in the list > in one statement? > > In R I do

Re: list subsetting

2009-01-21 Thread bearophileHUGS
FogleBird: > a.count(3.14) If the values to count are approximated FP values, then you may need something more complex, like: leniter(ifilter(somefunction, a)) Where somefunction uses an approximated comparison, and leniter is just a function that counts the items of a generic iterator. Bye, be

Re: quick beginners List comprehension question

2009-01-21 Thread Terry Reedy
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: Does Python really follow its philosophy of "Readability counts"?

2009-01-21 Thread Luis Zarrabeitia
On Wednesday 21 January 2009 04:16:38 pm Russ P. wrote: > 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 lan

Re: list subsetting

2009-01-21 Thread Jeff McNeil
On Jan 21, 4:53 pm, culpritNr1 wrote: > Hello All, > > Say I have a list like this: > > a = [0 , 1, 3.14, 20, 8, 8, 3.14] > > Is there a simple python way to count the number of 3.14's in the list in > one statement? > > In R I do like this > > a = c(0 , 1, 3.14, 20, 8, 8, 3.14) > > length( a[ a[]

Re: list subsetting

2009-01-21 Thread FogleBird
On Jan 21, 4:53 pm, culpritNr1 wrote: > Hello All, > > Say I have a list like this: > > a = [0 , 1, 3.14, 20, 8, 8, 3.14] > > Is there a simple python way to count the number of 3.14's in the list in > one statement? > > In R I do like this > > a = c(0 , 1, 3.14, 20, 8, 8, 3.14) > > length( a[ a[]

Re: English-like Python

2009-01-21 Thread Aaron Brady
On Jan 21, 9:24 am, Joe Strout wrote: > 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. functio

Re: what's the point of rpython?

2009-01-21 Thread Ross Ridge
Scott David Daniels wrote: >The opcode cannot simply talk to its cache, it must either go directly >to off-chip memory or communicate to other processors that it (and it >alone) owns the increment target. In fact all it does simply talk to its cache. From the "Intel 64 and IA-32 Architectures S

list subsetting

2009-01-21 Thread culpritNr1
Hello All, Say I have a list like this: a = [0 , 1, 3.14, 20, 8, 8, 3.14] Is there a simple python way to count the number of 3.14's in the list in one statement? In R I do like this a = c(0 , 1, 3.14, 20, 8, 8, 3.14) length( a[ a[]==3.14 ] ) How do I do that in standard python? (Note that

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

2009-01-21 Thread Terry Reedy
Luke Kenneth Casson Leighton wrote: i look forward to seeing the same incremental improvement applied to the development of python, evidence of which would be clearly seen by the acceptance of one of the following patches, one of which is dated 2003: http://bugs.python.org/issue841454 Again

Cannot contact Python webmaster!

2009-01-21 Thread r
Does anybody know how to get in touch with the www.python.org website maintainers? i sent mail to webmas...@python.org but it just bounces back. Is anybody even there? :) -- http://mail.python.org/mailman/listinfo/python-list

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

2009-01-21 Thread John Machin
On Jan 22, 2:17 am, a...@pythoncraft.com (Aahz) wrote: > 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

Re: is this pythonic?

2009-01-21 Thread Scott David Daniels
prueba...@latinmail.com wrote: ... If you have duplicates this will not work. You will have to do something like this instead: o=[] i=0 ln=len(l) while i if l[i]['title']=='ti': o.append(l.pop(i)) ln-=1 else: i+=1 Or the followin

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

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: 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: 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: 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: 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: 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: 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

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: 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

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: 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

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: 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 > > >

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: 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

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: 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

[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: 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

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: 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: 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: 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: 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: 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: 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

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: 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

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: 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: 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: 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: 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

  1   2   >