Re: Two Dictionaries and a Sum!

2013-05-17 Thread nanobio
total,amount=0,0 for key in prices.keys(): amount=prices[key]*stock[key] total+=amount print "%s %s" % (amount,total) -- http://mail.python.org/mailman/listinfo/python-list

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

2013-05-17 Thread Chris Angelico
On Sat, May 18, 2013 at 2:01 PM, Steven D'Aprano wrote: > Consider if x is an arbitrary object, and you call "%s" % x: > > py> "%s" % 23 # works > '23' > py> "%s" % [23, 42] # works > '[23, 42]' > > and so on for *almost* any object. But if x is a tuple, strange things > happen Which can be gua

Re: Two Dictionaries and a Sum!

2013-05-17 Thread nanobio
total,amount=0,0 for key in prices.keys(): price=prices[key]*stock[key] total+=price print "%s %s" % (price,total) -- http://mail.python.org/mailman/listinfo/python-list

Re: Two Dictionaries and a Sum!

2013-05-17 Thread Chris Angelico
On Sat, May 18, 2013 at 2:19 PM, 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, > "orange": 1.5, > "pear": 3 > } > > stoc

how to run another file inside current file?

2013-05-17 Thread 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. example -- import otherFile from apscheduler.sche

Re: Two Dictionaries and a Sum!

2013-05-17 Thread Spacelee
for key in prices.keys(): print prices[key]*stock[key] On Sat, May 18, 2013 at 12:19 PM, Bradley Wright < bradley.wright@gmail.com> 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: > > pri

Two Dictionaries and a Sum!

2013-05-17 Thread Bradley Wright
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, "orange": 1.5, "pear": 3 } stock = { "banana": 6, "apple": 0, "orange": 32, "pear": 15 }

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

2013-05-17 Thread Steven D'Aprano
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 it was going to be deprecated. :( Why replace such a > great and fast ope

Re: any cherypy powred sites I can check out?

2013-05-17 Thread Neil Cerutti
On 2013-05-17, 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"? '"I recently wrote a book called "How to Get Along with Everybody." I didn't write it myself--I wrote it so

Continuous Deployment Style Build System for Python

2013-05-17 Thread James Carpenter
Defend Against Fruit is focused on providing a pragmatic, continuous deployment style build system for Python. Current Python build systems do not properly account for the needs of effective continuous deployment. This package extends the Python tooling to add the missing pieces, including integrat

Re: Back-end Python Developer Seeking Telecommute Work

2013-05-17 Thread 88888 Dihedral
Rob Sutton於 2013年5月18日星期六UTC+8上午2時36分07秒寫道: > I am seeking part/full time work as a back-end Python developer (telecommute > or Utah only). I have been maintaining a > Debian/Python/Django/Apache/PostgreSQL/PHP/MySql web application for 3 years > on my own. I do all the development, database a

Re: any cherypy powred sites I can check out?

2013-05-17 Thread Walter Hurry
On Fri, 17 May 2013 18:15:38 +0100, 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"? There are very few posters to this NG in the Hurry bozo bin, but OP is now one. --

Back-end Python Developer Seeking Telecommute Work

2013-05-17 Thread Rob Sutton
I am seeking part/full time work as a back-end Python developer (telecommute or Utah only). I have been maintaining a Debian/Python/Django/Apache/PostgreSQL/PHP/MySql web application for 3 years on my own. I do all the development, database and system management myself. I can setup a complete

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

2013-05-17 Thread Carlos Nepomuceno
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. :/ > On Fri, 17 May 2013 18:20:33 +0300, Carlos Nepomuceno wrote: > >> ### fastwrite5.py ### >> import cStringIO >> size = 50*1024*1024 >> value = 0 >>

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

2013-05-17 Thread Carlos Nepomuceno
You've hit the bullseye! ;) Thanks a lot!!! > Oh, I forgot to mention: you have a bug in this function. You're already > including the newline in the len(line), so there is no need to add one. > The result is that you only generate 44MB instead of 50MB. That's because I'm running on Windows. Wha

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

2013-05-17 Thread Steven D'Aprano
On Fri, 17 May 2013 18:20:33 +0300, Carlos Nepomuceno wrote: > ### fastwrite5.py ### > import cStringIO > size = 50*1024*1024 > value = 0 > filename = 'fastwrite5.dat' > x = 0 > b = cStringIO.StringIO() > while x < size: >     line = '{0}\n'.format(value) >     b.write(line) >     value += 1 >    

Re: Diacretical incensitive search

2013-05-17 Thread jmfauth
The handling of diacriticals is especially a nice case study. One can use it to toy with some specific features of Unicode, normalisation, decomposition, ... ... and also to show how Unicode can be badly implemented. First and quick example that came to my mind (Py325 and Py332): >>>

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

2013-05-17 Thread Carlos Nepomuceno
Thank you Steve! You are totally right! It takes about 0.2s for the f.write() to return. Certainly because it writes to the system file cache (~250MB/s). Using a little bit different approach I've got: C:\src\Python>python -m timeit -cvn3 -r3 -s"from fastwrite5r import run" "run()" raw times: 2

Re: any cherypy powred sites I can check out?

2013-05-17 Thread Mark Lawrence
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"? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/li

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

2013-05-17 Thread Steven D'Aprano
On Fri, 17 May 2013 18:20:33 +0300, Carlos Nepomuceno wrote: > I've got the following results on my desktop PC (Win7/Python2.7.5): > > C:\src\Python>python -m timeit -cvn3 -r3 "execfile('fastwrite2.py')" raw > times: 123 126 125 > 3 loops, best of 3: 41 sec per loop Your times here are increased

Re: Diacretical incensitive search

2013-05-17 Thread Olive
Tanks a lot! -- http://mail.python.org/mailman/listinfo/python-list

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

2013-05-17 Thread Carlos Nepomuceno
I've got the following results on my desktop PC (Win7/Python2.7.5): C:\src\Python>python -m timeit -cvn3 -r3 "execfile('fastwrite2.py')" raw times: 123 126 125 3 loops, best of 3: 41 sec per loop C:\src\Python>python -m timeit -cvn3 -r3 "execfile('fastwrite5.py')" raw times: 34 34.3 34 3 loops, b

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

2013-05-17 Thread Dave Angel
On 05/17/2013 12:35 AM, lokeshkopp...@gmail.com wrote: On Friday, May 17, 2013 8:50:26 AM UTC+5:30, lokesh...@gmail.com wrote: I need to write numbers into a file upto 50mb and it should be fast can any one help me how to do that? i had written the following code.. value = 0 with open(file

Re: Diacretical incensitive search

2013-05-17 Thread Peter Otten
Olive wrote: > One feature that seems to be missing in the re module (or any tools that I > know for searching text) is "diacretical incensitive search". I would like > to have a match for something like this: > > re.match("franc", "français") > > in about the same whay we can have a case incens

Re: Diacretical incensitive search

2013-05-17 Thread Petite Abeille
On May 17, 2013, at 8:57 AM, Olive wrote: > The algorithm to write such a function is trivial but there are a lot of mark > we can put on a letter. It would be necessary to have the list of "a"'s with > something on it. i.e. "à,á,ã", etc. and this for every letter. Trying to make > such a lis

Diacretical incensitive search

2013-05-17 Thread Olive
One feature that seems to be missing in the re module (or any tools that I know for searching text) is "diacretical incensitive search". I would like to have a match for something like this: re.match("franc", "français") in about the same whay we can have a case incensitive search: re.match("(