Re: any cherypy powred sites I can check out?

2013-05-18 Thread Chris Angelico
On Sat, May 18, 2013 at 3:15 AM, Mark Lawrence wrote: > On 17/05/2013 01:00, visphatesj...@gmail.com wrote: >> >> fuck straight off >> > > I assume you're the author of "How to win friends and influence people"? Not quite. He's the author of the social networking version, "How to win influence an

Fwd: Fwd: Fwd: Fwd: Python for philosophers

2013-05-18 Thread Citizen Kant
rusi said: > And let me suggest that you follow your own advise -- Can you say what > you have to say in 1/10th the number of words? Ok if not 1/10th then > 1/5th? 1-third? Thanks for the suggestion. I apologize for being that expansive; maybe you are right about this. In my world less use to be

Re: any cherypy powred sites I can check out?

2013-05-18 Thread Chris Angelico
On Fri, May 17, 2013 at 10:09 AM, alex23 wrote: > On May 17, 10:00 am, visphatesj...@gmail.com wrote: >> is a cherrypy list accessible here on web thru google groups? > > Is an apology for your offensive response to Chris Angelico > forthcoming? In complete absence of all semblance of context, I

RE: How to write fast into a file in python?

2013-05-18 Thread Carlos Nepomuceno
BTW, I've downloaded from the following places: http://stromberg.dnsalias.org/svn/bufsock/trunk/bufsock.py http://stromberg.dnsalias.org/~dstromberg/backshift/documentation/html/python2x3-pysrc.html Are those the latest versions? > From: carlosnepomuc...@

RE: How to write fast into a file in python?

2013-05-18 Thread Carlos Nepomuceno
Thanks Dan! I've never used CPython or PyPy. Will try them later. I think the main difference between your create_file_numbers_file_like() and the fastwrite5.py I sent earlier is that I've used cStringIO instead of StringIO. It took 12s less using cStringIO. My numbers are much greater, but I'v

Re: Python for philosophers

2013-05-18 Thread Michael Torrie
On 05/18/2013 08:30 PM, 8 Dihedral wrote: > I am too lazy to write a factorial computations with primes > here. Ahh, that's better. -- http://mail.python.org/mailman/listinfo/python-list

RE: How to write fast into a file in python?

2013-05-18 Thread Carlos Nepomuceno
> Date: Sat, 18 May 2013 22:41:32 -0400 > From: da...@davea.name > To: python-list@python.org > Subject: Re: How to write fast into a file in python? > > On 05/18/2013 01:00 PM, Carlos Nepomuceno wrote: >> Python really writes '\n\r' on Windows. Just check t

Re: Please help with Threading

2013-05-18 Thread Cameron Simpson
On 19May2013 03:02, Carlos Nepomuceno wrote: | Just been told that GIL doesn't make things slower, but as I | didn't know that such a thing even existed I went out looking for | more info and found that document: | http://www.dabeaz.com/python/UnderstandingGIL.pdf | | Is it current? I didn't know

Re: Future standard GUI library

2013-05-18 Thread llanitedave
I'm curious about how commonly tkinter is actually used among Python app developers as compared to wx, Pyside, or PyQT. I get the impression that more distributed apps are built with wxPython, at least, than tkinter. My impression is far from actual knowledge, of course. -- http://mail.python

Re: How to write fast into a file in python?

2013-05-18 Thread Dave Angel
On 05/18/2013 01:00 PM, Carlos Nepomuceno wrote: Python really writes '\n\r' on Windows. Just check the files. That's backwards. '\r\n' on Windows, IF you omit the b in the mode when creating the file. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for philosophers

2013-05-18 Thread 88888 Dihedral
Chris Angelico於 2013年5月19日星期日UTC+8上午8時04分45秒寫道: > On Sun, May 19, 2013 at 9:56 AM, 8 Dihedral > > wrote: > > > Hey, ChisA, are you delibrately to write a recursive version > > > to demonstrate the stack depth problem in Python? > > > > > > def fact(n): > > >ret=1 > > >if n>1: #

Re: mutable ints: I think I have painted myself into a corner

2013-05-18 Thread Cameron Simpson
On 19May2013 11:11, Chris Angelico wrote: | On Sun, May 19, 2013 at 10:26 AM, Cameron Simpson wrote: | > Before I toss this approach and retreat to my former "object" | > technique, does anyone see a way forward to modify an int subclass | > instance in place? (That doesn't break math, preferably

Re: mutable ints: I think I have painted myself into a corner

2013-05-18 Thread Chris Angelico
On Sun, May 19, 2013 at 10:26 AM, Cameron Simpson wrote: > Before I toss this approach and retreat to my former "object" > technique, does anyone see a way forward to modify an int subclass > instance in place? (That doesn't break math, preferably; I don't > do arithmetic with these things but the

mutable ints: I think I have painted myself into a corner

2013-05-18 Thread Cameron Simpson
TL;DR: I think I want to modify an int value "in place". Yesterday I was thinking about various "flag set" objects I have floating around which are essentially bare "object"s whose attributes I access, for example: flags = object() flags.this = True flags.that = False and then elsewhere:

Re: Please help with Threading

2013-05-18 Thread Chris Angelico
On Sun, May 19, 2013 at 10:02 AM, Carlos Nepomuceno wrote: > I didn't know Python threads aren't preemptive. Seems to be something really > old considering the state of the art on parallel execution on multi-cores. > > What's the catch on making Python threads preemptive? Are there any ongoing >

Re: Python for philosophers

2013-05-18 Thread Chris Angelico
On Sun, May 19, 2013 at 9:56 AM, 8 Dihedral wrote: > Hey, ChisA, are you delibrately to write a recursive version > to demonstrate the stack depth problem in Python? > > def fact(n): >ret=1 >if n>1: # integer checking is not used but can be added > for x in xrange(n): ret*=x >

RE: Please help with Threading

2013-05-18 Thread Carlos Nepomuceno
> To: python-list@python.org > From: wlfr...@ix.netcom.com > Subject: Re: Please help with Threading > Date: Sat, 18 May 2013 15:28:56 -0400 > > On Sat, 18 May 2013 01:58:13 -0700 (PDT), Jurgens de Bruin > declaimed the following in > gmane.comp.python.gene

Re: Python for philosophers

2013-05-18 Thread 88888 Dihedral
Chris Angelico於 2013年5月14日星期二UTC+8上午12時24分44秒寫道: > On Tue, May 14, 2013 at 12:53 AM, rusi wrote: > > > int fact(int n, int acc) > > > { > > > return !n? acc : fact(n-1,acc*n); > > > } > > > - > > > When I run these, the C happily keeps giving answers until a

Re: python script is not running

2013-05-18 Thread Chris Angelico
On Sun, May 19, 2013 at 4:43 AM, Vincent Vande Vyvre wrote: > Le 18/05/2013 19:59, Chris Angelico a écrit : > >> On Sun, May 19, 2013 at 3:35 AM, woooee wrote: >>> >>> The obvious question, do you have the shebang on the first line so the >>> OS knows it's to be run as a Python program? >> >> Tha

Re: How to write fast into a file in python?

2013-05-18 Thread Steven D'Aprano
On Sat, 18 May 2013 15:14:31 -0400, Dennis Lee Bieber wrote: > tOn Sat, 18 May 2013 08:49:55 +0100, Fábio Santos > declaimed the following in > gmane.comp.python.general: > > >> You mentioned "\n" translating to two lines, but this won't happen. >> Windows will not mess with what you write to y

Re: Future standard GUI library

2013-05-18 Thread Beinan Li
Thanks for the clarification, Kevin. It's nice to have a tk dev standing out :-) This more or less convinced me about the trend. I also agree that it would be probably a simpler and more maintainable way to write my own tk(inter) code than using any existing 3rd-party designers. Beinan On Sat,

Re: Future standard GUI library

2013-05-18 Thread Steven D'Aprano
On Sat, 18 May 2013 10:03:02 -0400, Beinan Li wrote: > Do you think tkinter is going to be the standard python built-in gui > solution as long as python exists? Probably. > I couldn't help but wonder if wx or PySide receives better py2 and py3 > support, or anything else that prevent them from g

Re: How to write fast into a file in python?

2013-05-18 Thread Fábio Santos
On 18 May 2013 20:19, "Dennis Lee Bieber" wrote: > > tOn Sat, 18 May 2013 08:49:55 +0100, Fábio Santos > declaimed the following in > gmane.comp.python.general: > > > > You mentioned "\n" translating to two lines, but this won't happen. Windows > > will not mess with what you write to your file.

Re: TypeError: unbound method add() must be called with BinaryTree instance as first argument (got nothing instead)

2013-05-18 Thread Terry Jan Reedy
On 5/18/2013 3:46 PM, Peter Otten wrote: Dan Stromberg wrote: python 2.x, python 3.x and pypy all give this same error, though jython errors out at a different point in the same method. By the way, 3.x doesn't have unbound methods, so that should work. It does for this example (3.3.1) >>> c

Re: Future standard GUI library

2013-05-18 Thread Terry Jan Reedy
On 5/18/2013 10:03 AM, Beinan Li wrote: Not sure if this is the right place to talk about this. It is. Even less sure if I can move this discussion to tkinter list, The idea of replacing tkinter is not about improving tkinter ;-). Do you think tkinter is going to be the standard python bu

Re: TypeError: unbound method add() must be called with BinaryTree instance as first argument (got nothing instead)

2013-05-18 Thread Peter Otten
Dan Stromberg wrote: > python 2.x, python 3.x and pypy all give this same error, though jython > errors out at a different point in the same method. By the way, 3.x doesn't have unbound methods, so that should work. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to write fast into a file in python?

2013-05-18 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > tOn Sat, 18 May 2013 08:49:55 +0100, Fábio Santos > declaimed the following in > gmane.comp.python.general: > > > > You mentioned "\n" translating to two lines, but this won't happen. Windows > > will not mess with what you write to your file. It's just

Re: How to write fast into a file in python?

2013-05-18 Thread Dan Stromberg
With CPython 2.7.3: ./t time taken to write a file of size 52428800 is 15.86 seconds time taken to write a file of size 52428800 is 7.91 seconds time taken to write a file of size 52428800 is 9.64 seconds With pypy-1.9: ./t time taken to write a file of size 52428800 is 3.708232 seconds

Re: TypeError: unbound method add() must be called with BinaryTree instance as first argument (got nothing instead)

2013-05-18 Thread Peter Otten
Dan Stromberg wrote: > I'm getting the error in the subject, from the following code: > def add(self, key): > """ > Adds a node containing I{key} to the subtree > rooted at I{self}, returning the added node. > """ > node = self.find(key) > if not

TypeError: unbound method add() must be called with BinaryTree instance as first argument (got nothing instead)

2013-05-18 Thread Dan Stromberg
I'm getting the error in the subject, from the following code: def add(self, key): """ Adds a node containing I{key} to the subtree rooted at I{self}, returning the added node. """ node = self.find(key) if not node: node.key = key

Re: python script is not running

2013-05-18 Thread Vincent Vande Vyvre
Le 18/05/2013 19:59, Chris Angelico a écrit : On Sun, May 19, 2013 at 3:35 AM, woooee wrote: The obvious question, do you have the shebang on the first line so the OS knows it's to be run as a Python program? That won't make any difference; the cron job specifically stipulates the interpreter.

SQLObject 1.4.0

2013-05-18 Thread Oleg Broytman
Hello! I'm pleased to announce version 1.4.0, the first stable release of branch 1.4 of SQLObject. What's new in SQLObject === Features & Interface * Support for PostgreSQL 8.1 is dropped. The minimal supported version of PostgreSQL is 8.2 now. * Opt

Re: python script is not running

2013-05-18 Thread Chris Angelico
On Sun, May 19, 2013 at 3:35 AM, woooee wrote: > The obvious question, do you have the shebang on the first line so the > OS knows it's to be run as a Python program? That won't make any difference; the cron job specifically stipulates the interpreter. It just needs to be done with a full path.

Re: python script is not running

2013-05-18 Thread woooee
The obvious question, do you have the shebang on the first line so the OS knows it's to be run as a Python program? Also I would change tryJson() to if __name__ == "__main__': tryJson() This probably won't make any difference but you will have the bases covered. -- http://mail.python.org/mai

RE: How to write fast into a file in python?

2013-05-18 Thread Carlos Nepomuceno
Python really writes '\n\r' on Windows. Just check the files. Internal representations only keep '\n' for simplicity, but if you wanna keep track of the file length you have to take that into account. ;) > Date: Sat, 18 May 2013 08:49:55 +0100 > Subject: RE: How

Re: how to run another file inside current file?

2013-05-18 Thread Terry Jan Reedy
On 5/18/2013 7:15 AM, Kevin Xi wrote: Hi, It's better to specify version of python you work with. Absolutely. I know nothing about python 3 but in python 2 you can do this with `exec`. Example: > f = file('otherFile.py') > exec f Py 2 has execfile that does the above. Py 3 do as above

Re: python script is not running

2013-05-18 Thread Terry Jan Reedy
On 5/18/2013 6:12 AM, Avnesh Shakya wrote: hi, i want to run python script which generating data into json fromat, I am using crontab, but it's not executing... my python code-- try.py -- import json import simplejson as json import sys def tryJson(): saved = sys.stdout correctF

Re: Future standard GUI library

2013-05-18 Thread Kevin Walzer
Hello, On 5/18/13 10:03 AM, Beinan Li wrote: I know this may sound a silly question because no one can see the future. But ... Do you think tkinter is going to be the standard python built-in gui solution as long as python exists? I don't see any significant clamoring among the Python core de

Re: How to write fast into a file in python?

2013-05-18 Thread Chris Angelico
On Sat, May 18, 2013 at 5:49 PM, Fábio Santos wrote: > Putting len(os.linesep)'s value into a local variable will make accessing it > quite a bit faster. But why would you want to do that? > > You mentioned "\n" translating to two lines, but this won't happen. Windows > will not mess with what you

Fwd: Re: python script is not running

2013-05-18 Thread Vincent Vande Vyvre
Message original Sujet: Re: python script is not running Date : Sat, 18 May 2013 12:36:55 +0200 De :Vincent Vande Vyvre Pour : Avnesh Shakya Le 18/05/2013 12:12, Avnesh Shakya a écrit : hi, i want to run python script which generating data into json fromat, I

Future standard GUI library

2013-05-18 Thread Beinan Li
Not sure if this is the right place to talk about this. Even less sure if I can move this discussion to tkinter list, so here I am... I know this may sound a silly question because no one can see the future. But ... Do you think tkinter is going to be the standard python built-in gui solution as l

Re: Please help with Threading

2013-05-18 Thread Dave Angel
On 05/18/2013 04:58 AM, Jurgens de Bruin wrote: This is my first script where I want to use the python threading module. I have a large dataset which is a list of dict this can be as much as 200 dictionaries in the list. The final goal is a histogram for each dict 16 histograms on a page ( 4x

Re: python script is not running

2013-05-18 Thread Roy Smith
In article , Chris Angelico wrote: > On Sat, May 18, 2013 at 8:12 PM, Avnesh Shakya wrote: > > avin@hp:~$ crontab -e > > then type - > > */2 * * * * python /home/avin/data/try.py > > > > You may need to put an explicit path to your Python interpreter. Type: > > $ which python > > and put tha

Re: python script is not running

2013-05-18 Thread Chris Angelico
On Sat, May 18, 2013 at 8:12 PM, Avnesh Shakya wrote: > avin@hp:~$ crontab -e > then type - > */2 * * * * python /home/avin/data/try.py > You may need to put an explicit path to your Python interpreter. Type: $ which python and put that into your crontab. ChrisA -- http://mail.python.org/mail

Re: Two Dictionaries and a Sum!

2013-05-18 Thread Roy Smith
In article <6012d69f-b65e-4d65-90c4-f04876853...@googlegroups.com>, Bradley Wright wrote: > Confusing subject for a confusing problem (to a novice like me of course!) > Thx for the help in advance folks > > I have (2) dictionaries: > > prices = { > "banana": 4, > "apple": 2, > "ora

Re: Please help with Threading

2013-05-18 Thread Peter Otten
Jurgens de Bruin wrote: > I will post code - the entire scripts is 1000 lines of code - can I post > the threading functions only? Try to condense it to the relevant parts, but make sure that it can be run by us. As a general note, when you add new stuff to an existing longish script it is alw

Re: Please help with Threading

2013-05-18 Thread Jurgens de Bruin
I will post code - the entire scripts is 1000 lines of code - can I post the threading functions only? -- http://mail.python.org/mailman/listinfo/python-list

Re: python script is not running

2013-05-18 Thread fjct...@gmail.com
make sure data.json is absolute path make sure you test it directly without crontab in the crontab, execute the script in such way, python scripty > /tmp/log 2>&1 check the log 发自我的小米手机 Avnesh Shakya 编写: >hi, >i want to run python script which generating data into json fromat, I am > u

Re: how to run another file inside current file?

2013-05-18 Thread Kevin Xi
Hi, It's better to specify version of python you work with. I know nothing about python 3 but in python 2 you can do this with `exec`. Example: > f = file('otherFile.py') > exec f For more, read the doc: http://docs.python.org/2.7/reference/simple_stmts.html#the-exec-statement HTH

Re: How to write fast into a file in python?

2013-05-18 Thread 88888 Dihedral
Steven D'Aprano於 2013年5月18日星期六UTC+8下午12時01分13秒寫道: > On Fri, 17 May 2013 21:18:15 +0300, Carlos Nepomuceno wrote: > > > > > I thought there would be a call to format method by "'%d\n' % i". It > > > seems the % operator is a lot faster than format. I just stopped using > > > it because I read i

Re: how to run another file inside current file?

2013-05-18 Thread fjct...@gmail.com
subprocess? 发自我的小米手机 Avnesh Shakya 编写: >hi, > I want to run a another file inside a ached.add_cron_job(..). how is it > possible, please help me, I have a file otherFile.py for execution inside > current file. >I know it is very easy question but i m unable to get anything, please help me.

python script is not running

2013-05-18 Thread Avnesh Shakya
hi, i want to run python script which generating data into json fromat, I am using crontab, but it's not executing... my python code-- try.py -- import json import simplejson as json import sys def tryJson(): saved = sys.stdout correctFile = file('data.json', 'a+') sys.stdout = c

Re: Please help with Threading

2013-05-18 Thread Peter Otten
Jurgens de Bruin wrote: > This is my first script where I want to use the python threading module. I > have a large dataset which is a list of dict this can be as much as 200 > dictionaries in the list. The final goal is a histogram for each dict 16 > histograms on a page ( 4x4 ) - this already w

Please help with Threading

2013-05-18 Thread Jurgens de Bruin
This is my first script where I want to use the python threading module. I have a large dataset which is a list of dict this can be as much as 200 dictionaries in the list. The final goal is a histogram for each dict 16 histograms on a page ( 4x4 ) - this already works. What I currently do is

RE: How to write fast into a file in python?

2013-05-18 Thread Fábio Santos
On 17 May 2013 19:38, "Carlos Nepomuceno" wrote: > > Think the following update will make the code more portable: > > x += len(line)+len(os.linesep)-1 > > Not sure if it's the fastest way to achieve that. :/ > Putting len(os.linesep)'s value into a local variable will make accessing it quite a bi