Why this difference?

2011-02-24 Thread n00m
file my.txt: === 0 beb 1 qwe 2 asd 3 hyu 4 zed 5 asd 6 oth = py script: === import sys sys.stdin = open('88.txt', 'r') t = sys.stdin.readlines() t = map(lambda rec: rec.split(), t) print t print t[2][1] == t[5][1

Re: Why this difference?

2011-02-24 Thread n00m
The 1st "False" is not surprising for me. It's the 2nd "True" is a bit hmmm... ok, it doesn't matter == Have a nice day! -- http://mail.python.org/mailman/listinfo/python-list

Re: Why this difference?

2011-02-24 Thread n00m
> Don't rely on it. Hmm I never was about to rely on it. Simply sorta my academic curiosity. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why this difference?

2011-02-24 Thread n00m
@nn, @Terry Reedy: Good reading. Thanks. In fact now the case is closed. -- http://mail.python.org/mailman/listinfo/python-list

I'm happy with Python 2.5

2011-02-27 Thread n00m
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 and Idon't move neither up nor down from it (the best & the fastest version) -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm happy with Python 2.5

2011-02-27 Thread n00m
Python 3 is a tempor. lapse of reason. Just my an intuitive sensation, nothing objective in it. -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm happy with Python 2.5

2011-02-27 Thread n00m
Steve, see a list of accepted langs there, in bottom dropdown: http://www.spoj.pl/submit/ There *was* Python 2.6. Then admins shifted back to 2.5. People vote by their legs. -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm happy with Python 2.5

2011-02-27 Thread n00m
On Feb 27, 3:58 pm, Grigory Javadyan wrote: > what the hell does that have to do with anything > > On Sun, Feb 27, 2011 at 5:34 PM, n00m wrote: > > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit > > (Intel)] on win32 > > > and Idon't move ne

Re: I'm happy with Python 2.5

2011-02-27 Thread n00m
http://www.spoj.pl/problems/TMUL/ Python's "print a * b" gets Time Limit Exceeded. = PHP's code = fscanf(STDIN, "%d\n", &$tcs); while ($tcs--) { fscanf(STDIN, "%s %s\n", &$n, &$m); echo bcmul($

Re: OT: Code Examples

2011-02-28 Thread n00m
On Feb 28, 6:03 pm, Fred Marshall wrote: > I'm interested in developing Python-based programs, including an > engineering app. ... re-writing from Fortran and C versions.  One of the > objectives would to be make reasonable use of the available structure > (objects, etc.).  So, I'd like to read a

ImSim: Image Similarity

2011-03-04 Thread n00m
Let me present my newborn project (in Python) ImSim: http://sourceforge.net/projects/imsim/ Its README.txt: - ImSim is a python script for finding the most similar pic(s) to a given one among a set/list/db of your pics. The scrip

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
I uploaded a new version of the subject with a VERY MINOR correction in it. Namely, in line #55: print '%12s %7.2f' % (db[k][1], db[k][0] / 3600.0,) instead of print '%12s %7.2f' % (db[k][1], db[k][0] * 0.001,) I.e. I normalized it to base = 100. Now the values of similarity can't be g

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
On Mar 5, 7:10 pm, Mel wrote: > n00m wrote: > > > I uploaded a new version of the subject with a > > VERY MINOR correction in it. Namely, in line #55: > > >     print '%12s %7.2f' % (db[k][1], db[k][0] / 3600.0,) > > > instead of > > &g

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
> > Is it better than this? > - scale each image to 100x100 > - go black&white in such a way that half the pixels are black > - XOR the images and count the mismatches It's *much* better but I'm not *much* about to prove it. > I'm sure there are better, > well-known algorithms. The best well

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
PS For some reason they don't update the link to the last version. It's _20110306, here: http://sourceforge.net/projects/imsim/files/ I use Python 2.5 & PIL for Python 2.5 -- http://mail.python.org/mailman/listinfo/python-list

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
On Mar 6, 6:10 am, Mel wrote: > n00m wrote: > > As for using color info... > > my current strong opinion is: the colors must be forgot for good. > > Paradoxically but "profound" elaboration and detailization can/will > > spoil/undermine the whole thing. Ju

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
http://www.nga.gov/search/index.shtm http://deyoung.famsf.org/search-collections etc Seems they all offer search only by keywords and this kind. What about to submit e.g. roses2.jpg (copy) and to find its original? Assume we don't know its author neither its title -- http://mail.python.org/mailman

Re: ImSim: Image Similarity

2011-03-06 Thread n00m
Obviously if we'd use it in practice (in a web-museum ?) all pic's matrices should be precalculated only once and stored in a table with fourty fields v00 ... v93 like: --- pic_title v00v01v02... v93 -

Re: ImSim: Image Similarity

2011-03-06 Thread n00m
On Mar 6, 8:55 pm, John Bokma wrote: > n00m writes: > >http://www.nga.gov/search/index.shtm > >http://deyoung.famsf.org/search-collections > > etc > > Seems they all offer search only by keywords and this kind. > > What about to submit e.g. roses2.jpg (copy) and

Re: I'm happy with Python 2.5

2011-03-06 Thread n00m
On Mar 6, 7:25 pm, Michael Torrie wrote: > On 02/27/2011 06:57 AM, n00m wrote: > > > Steve, see a list of accepted langs there, in bottom dropdown: > >http://www.spoj.pl/submit/There *was* Python 2.6. > > Then admins shifted back to 2.5. People vote by their legs. >

Re: ImSim: Image Similarity

2011-03-06 Thread n00m
On Mar 6, 10:17 pm, n00m wrote: > On Mar 6, 8:55 pm, John Bokma wrote: > > > > > n00m writes: > > >http://www.nga.gov/search/index.shtm > > >http://deyoung.famsf.org/search-collections > > > etc > > > Seems they all offer search only by

Re: I'm happy with Python 2.5

2011-03-06 Thread n00m
PS The winner (just a schoolboy) of IOI 2009 lives in my town, not very far from my house. I'm proud to have such a neibour. His account on spoj: http://www.spoj.pl/users/tourist/ Of course he's also registered on many other online judge systems, incl. www.topcoder.com -- http://mail.python.org/ma

Re: ImSim: Image Similarity

2011-03-06 Thread n00m
As for "proper" quoting: I read/post to this group via my web-browser. And for me everything looks OK. I don't even quite understand what exactly do you mean by your remark. I'm not a facebookie/forumish/twitterish thing. Btw I don't know what is the twitter. I don't need it, neither to know nor t

Re: I'm happy with Python 2.5

2011-03-06 Thread n00m
http://www.spoj.pl/forum/viewtopic.php?f=20&t=8264 That's all what I meant to say in here. User numerix (German?) knows ropes of Python miles far better than e.g. me. -- http://mail.python.org/mailman/listinfo/python-list

Re: ImSim: Image Similarity

2011-03-07 Thread n00m
On Mar 6, 7:54 pm, n00m wrote: > If someone will encounter 2 apparently unrelated pics > but for which ImSim gives value of their mutual diff. > *** less than 20% *** please emailed them to me. Never mind, people. I've found such a pair of images in my .zipped project. It's &q

Re: ImSim: Image Similarity

2011-03-07 Thread n00m
On Mar 7, 2:54 pm, Grigory Javadyan wrote: > Just admit that your algorithm doesn't work that well already :-) > Or give a solid formal definition of "similarity" and prove that your > algo works with that definition. > > On Mon, Mar 7, 2011 at 4:22 PM, n00m wrote:

Re: ImSim: Image Similarity

2011-03-07 Thread n00m
So, my current very strict definition of similarity is: --- 2 pics are similar if my script gives for them value < 20%, otherwise the pics are not similar. --- It is left to study possi

Re: ImSim: Image Similarity

2011-03-07 Thread n00m
@all and just in case. Also see my TiRG project (since 2011-01-31): http://sourceforge.net/projects/tirg/ It's for detecting and localizing textareas in raster graphics. Among its files there is a python script -- absolutely working. Enjoy to do with it whatever you like -- it's my public domain.

Madam Bovary

2011-03-10 Thread n00m
Just let you know: I'm on her (Emma's) side. -- http://mail.python.org/mailman/listinfo/python-list

Just finished reading of "What’s New In Python 3.0"

2011-03-10 Thread n00m
http://docs.python.org/py3k/whatsnew/3.0.html What's the fuss abt it? Imo all is ***OK*** with 3k (in the parts I understand). I even liked print as a function **more** than print as a stmt Now I think that Py3k is better than all prev pythons and cobras. -- http://mail.python.org/mailman/listi

Re: Just finished reading of "What’s New In Python 3.0"

2011-03-10 Thread n00m
On Mar 11, 4:05 am, alex23 wrote: > On Mar 11, 11:58 am, n00m wrote: > > >http://docs.python.org/py3k/whatsnew/3.0.html > > > What's the fuss abt it? Imo all is ***OK*** with 3k (in the parts I > > understand). > > I even liked print as a function **more**

Re: Just finished reading of "What’s New In Python 3.0"

2011-03-10 Thread n00m
On Mar 11, 7:45 am, Terry Reedy wrote: > On 3/10/2011 8:58 PM, n00m wrote: > > >http://docs.python.org/py3k/whatsnew/3.0.html > > > What's the fuss abt it? Imo all is ***OK*** with 3k (in the parts I > > understand). > > I even liked print as a function **m

Re: Just finished reading of "What’s New In Python 3.0"

2011-03-10 Thread n00m
On Mar 11, 8:35 am, Grigory Javadyan wrote: > > Moreover I'm often able to keep in mind 2 (or more) opposite ideas or > > opinions of mine. > > """ > To know and not to know, to be conscious of complete truthfulness > while telling carefully constructed lies, to hold simultaneously two > opinions

Re: Just finished reading of "What’s New In Python 3.0"

2011-03-11 Thread n00m
Fitzgerald had been an alcoholic since his college days, and became notorious during the 1920s for his extraordinarily heavy drinking, leaving him in poor health by the late 1930s. According to Zelda's biographer, Nancy Milford, Scott claimed that he had contracted tuberculosis, but Milford dismiss

Re: How should I handle socket receiving?

2011-03-11 Thread n00m
I'm abs not sure but maybe you'll need to put each client into separate thread; like this def Client_func(s2, cn): while 1: data = cn.recv(4096) if not data: s2.shutdown(1) return s2.sendall(data) cn, addr = s1.accept() s2 = socket.socke

Code run from IDLE but not via double-clicking on its *.py

2005-08-30 Thread n00m
When I double-click on "some.py" file console window appears just for a moment and right after that it's closed. If this script is started from inside of IDLE (F5 key) then it executes as it should be (e.g. executing all its print statements). Any ideas? OS: Windows; Python 2.3.4. Thanks. -- htt

Re: Code run from IDLE but not via double-clicking on its *.py

2005-08-30 Thread n00m
Thank you, guys, for your replies! Now it works! -- http://mail.python.org/mailman/listinfo/python-list

Re: Code run from IDLE but not via double-clicking on its *.py

2005-08-30 Thread n00m
Oops.. not everything so super as I thought. Incredible but from command line it results as: D:\>python23\python d:\python23\00\socket6.py Traceback (most recent call last): File "d:\python23\00\socket6.py", line 1, in ? import socket, thread File "D:\Python23\00\socket.py", line 3, in ?

Re: Code run from IDLE but not via double-clicking on its *.py

2005-08-31 Thread n00m
Richie Hindle wrote: > Because you have a socket.py in d:\python23\00 which is being picked up > instead of Python's own socket module. You shouldn't give your modules > the same name as Python's own modules. Yes, Richie! YOU are dmndly RIGHT! Thanks. -- http://mail.python.org/mailman/listinfo

Re: Code run from IDLE but not via double-clicking on its *.py

2005-08-31 Thread n00m
Funnily but I still can't get the code working... WITHOUT IDLE. I think it's because of "import thread" line. Seems something wrong with "opening" this module. In IDLE it works OK. -- http://mail.python.org/mailman/listinfo/python-list

Sockets: code works locally but fails over LAN

2005-08-31 Thread n00m
import socket, thread host, port = '192.168.0.3', 1434 s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s2.connect((host, 1433)) s1.bind((host, port)) s1.listen(1) cn, addr = s1.accept() def VB_SCRIPT(): while 1: data = cn.re

Re: Code run from IDLE but not via double-clicking on its *.py

2005-08-31 Thread n00m
Richie; Steve; Thanks for your replies! > o The command you're typing into the command prompt > o The error message you're getting > o The full traceback > o The code you're trying to run, or if it's too big then the piece that >the last line of the traceback refers to 1. D:\>python23\pyt

Re: Sockets: code works locally but fails over LAN

2005-08-31 Thread n00m
Thank you all for your replies! 1. repr() is not what I need (currently). I'd better like to see the pure text of "talkings" between VBS and SQL Server. 2. Jp, thank you very much for the links! I just oblige to test this Twisted stuff, but I'm afraid it's a bit above my head so far. And, frankly s

Re: Code run from IDLE but not via double-clicking on its *.py

2005-08-31 Thread n00m
Steve Holden wrote: > Now, let's see ... [presses fingers to temples and exercises psychic > powers] ... ah yes, its because you're DOING SOMETHING WRONG :-) I just admire this sort of humour! Made me chuckling and (even) laughing. -- http://mail.python.org/mailman/listinfo/python-list

Re: Code run from IDLE but not via double-clicking on its *.py

2005-09-01 Thread n00m
It's soo pity I'm too buzy at my work today. I'll reply a bit later. Thank you, guys! PS Port 1433 SQL Server listens to. PPS SQL Server is a rdbms from M$. -- http://mail.python.org/mailman/listinfo/python-list

Re: Code run from IDLE but not via double-clicking on its *.py

2005-09-01 Thread n00m
Dennis; Richie; >That sounds impossible, so I must be misunderstanding something. YOU - BOTH - UNDERSTAND ME ABSOLUTELY RIGHT! >1. >Start a new Command Prompt via Start / Programs / Accessories / Command >Prompt (or the equivalent on your machine) >2. >Type the following: d:\python23\python d:\pyt

Re: Sockets: code works locally but fails over LAN

2005-09-01 Thread n00m
>Bryan; I tested your code locally (in I*D*L*E) - it works fine! And of course I'll test it over LAN but only tomorrow - at work. See the picture of my IDLE window with output of your code: http://free.7host02.com/n00b/socket_Br.gif Note the 4th line in Blue: there Z is the name of my home machine,

Re: Code run from IDLE but not via double-clicking on its *.py

2005-09-02 Thread n00m
.txt or d:\python23\err.txt? NOTHING APPEARED IN THEM. > n00m, can you post the vbs? Set cn = CreateObject("ADODB.Connection") cn.Open _ "Provider=sqloledb;Data Source=192.168.0.3,1434;" & _ "Network Library=DBMSSOCN;Initial Catalog=pubs;" & _ "User

Re: Code run from IDLE but not via double-clicking on its *.py

2005-09-02 Thread n00m
Dennis: > However, threads aren't really needed for this simple connection > relay... The following has /not/ been run (since I don't have your > server nor VBS) but should do about the same thing (see comments for one > lack). To some degree you are right! If the vbs issues only some "primitive"

Re: problems with smtplib

2005-09-02 Thread n00m
I also can't get my SMTP (win2k) working with Python. But... funnily this works fine: import smtplib s = smtplib.SMTP('smtp.mail.ru') s.sendmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', 'hi there!') s.quit() Why do they (mail.ru) allow outsiders to use their service??? -- http://mail.python.or

Re: problems with smtplib

2005-09-02 Thread n00m
Steve Holden wrote: > That's pretty strange: the second argument should be a list. Are you > *sure* it worked? Hmm... I sent a couple of letters to my two different addresses... and got them! -- http://mail.python.org/mailman/listinfo/python-list

Re: Sockets: code works locally but fails over LAN

2005-09-02 Thread n00m
My today's tests (over LAN). I think *it* will drive me mad very soon. Firstly I tested both Bryan's codes. And they worked fine! Just as if they were tested locally! Then I tested Fredrik suggestion. And it worked out too. Expect unexpected, - as they say. At last I decided to test my own versi

Re: Code run from IDLE but not via double-clicking on its *.py

2005-09-02 Thread n00m
Dennis Lee Bieber wrote: > Hope you'll forgive my comment -- but for some reason those look... Your comments are absolutely relevant. > My version, using select(), shouldn't have this problem. Now I see what you meant ("You need no threads"). Your code works just fine (hope over LAN too). I correc

Re: Sockets: code works locally but fails over LAN

2005-09-03 Thread n00m
Bryan wrote: > Do you want to be a network engineer? lol... definetely not! It's just my curiosity. At my work my tools are: vba, vbs, jet-sql (ms access), t-sql (ms sql server). The pretty humble set. > My first two guess are: > The client is trying to make more than one connection. > Put

Re: Sockets: code works locally but fails over LAN

2005-09-03 Thread n00m
1. Python 2.3.4 2. Win98 and Win2k Professional -- http://mail.python.org/mailman/listinfo/python-list

Re: Sockets: code works locally but fails over LAN

2005-09-03 Thread n00m
Bryan; Look at how I corrected your the very first version (see added arguments in both functions). And now it really can handle multiple connections! import socket, thread sqls_host, sqls_port = '127.0.0.1', 1433 proxy_host, proxy_port = '127.0.0.1', 1434 # How I tested it: # sqls_host, sqls_p

Re: Sockets: code works locally but fails over LAN

2005-09-04 Thread n00m
Bryan Olson wrote: > Ah, yes, I see. (In my defense, I had already fixed that bug in > my second version.) 1. Yes! I myself noticed that, but your 2nd version looks a bit more verbose. 2. This all means... what? ONLY send() vs sendall() matters? Sometimes send() really sends ALL and my version work

List of integers & L.I.S.

2005-09-07 Thread n00m
Given a list of N arbitrarily permutated integers from set {1..N}. Need to find the ordering numbers of each integer in the LONGEST increasing sequence to which this number belongs. Sample: List: [4, 5, 6, 1, 2, 7, 3] Corresponding ordering numbers: [1, 2, 3, 1, 2, 4, 3] Details: e.g. number 7 b

Re: Code run from IDLE but not via double-clicking on its *.py

2005-09-07 Thread n00m
> Code run from IDLE but not via double-clicking on its *.py It still does not work. Weird. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sockets: code works locally but fails over LAN

2005-09-07 Thread n00m
I was trying to test the send() vs sendall() like this: x=send(data) print len(data)-x > 0 ? (when the code fails) but I could not reproduce the failures anymore. As if the lan got "refreshed" after the first using of sendall() instead of send(). Btw, why we need send() if there is sendall()? -

Re: List of integers & L.I.S.

2005-09-07 Thread n00m
Thanks guys! > Are you sure that this is not a homework problem? ... and let me reveal the secret: http://spoj.sphere.pl/problems/SUPPER/ Hardly it can be easily reduced to "standard" LIS problem (i.e. to find just a (any) Longest Increasing Sequence). > I coded a solution that can compute the or

Re: Sockets: code works locally but fails over LAN

2005-09-08 Thread n00m
Thanks, Bryan, for the details! Btw, the newest oops in the topic's subject is: the code does not work in the case of: sqls_host, sqls_port = '192.168.0.8', 1433 proxy_host, proxy_port = '192.168.0.3', 1434 ## proxy_host, proxy_port = '127.0.0.1', 1434 ## proxy_host, proxy_port = '', 1434 I.e. w

Re: List of integers & L.I.S.

2005-09-08 Thread n00m
[EMAIL PROTECTED] wrote: > So, this has no real world use, aside from posting it on a website. I don't think you're quite right. We never know where we gain and where we lose. > So clearly it served a very useful purpose! ;) Thanks, Manuel! > your question is different than the question on this

Re: List of integers & L.I.S.

2005-09-08 Thread n00m
PS: I've still not read 2 new posts. -- http://mail.python.org/mailman/listinfo/python-list

Re: List of integers & L.I.S.

2005-09-08 Thread n00m
> 4 5 1 2 3 6 7 8 << the list itself > 1 2 1 2 3 4 5 6 << ordering numbers for forward direction > 2 1 6 5 4 3 2 1 << ordering numbers for backward direction > === > 3 3 7 7 7 7 7 7 << sums of the pairs of ord. numbers Oops! Sorry for miscounting in backward direction. Should be (anyway the

Re: List of integers & L.I.S. (SPOILER)

2005-09-08 Thread n00m
Bravo, Bryan! It's incredibly fast! But your code got WA (wrong answer). See my latest submission: http://spoj.sphere.pl/status/SUPPER/ Maybe you slipped a kind of typo in it? Silly boundary cases? -- http://mail.python.org/mailman/listinfo/python-list

Re: List of integers & L.I.S. (SPOILER)

2005-09-09 Thread n00m
Bravo, Bryan! Looks very neat! (pity I can't give it a try in my Py 2.3.4 because of reversed() and sorted() functions) And I've submitted it but got ... TLEs: http://spoj.sphere.pl/status/SUPPER/ Funnily, the exec.time of the best C solution is only 0.06s! PS In my 1st submission I overlooked tha

Re: List of integers & L.I.S. (SPOILER)

2005-09-09 Thread n00m
Oops Bryan... I've removed my reply that you refer to... See my previous - CORRECT - reply. The code just times out... In some sense it doesn't matter right or wrong is its output. Btw, what is the complexity of your algorithm? Currently I'm at work and it's not easy for me to concentrate on our su

Re: List of integers & L.I.S. (SPOILER)

2005-09-09 Thread n00m
> nor even what submission is yours and your latest. Oops.. my UserName there is ZZZ. Submissions in the html table are ordered by date DESC. -- http://mail.python.org/mailman/listinfo/python-list

Re: List of integers & L.I.S. (SPOILER)

2005-09-09 Thread n00m
Oh! Seems you misunderstand me! See how the last block in your code should look: for tc in range(10): _ = stdin.readline() sequence = [int(ch) for ch in stdin.readline().split()] supers = supernumbers(sequence) print len(supers) for i in supers: print i, When I submi

Re: List of integers & L.I.S. (SPOILER)

2005-09-09 Thread n00m
It also timed out:( 241056 2005-09-09 20:11:19 ZZZ time limit exceeded - 7064 PYTH Btw, have a look at this nicest problem: http://spoj.sphere.pl/problems/COINS/ My py solution takes #64 place among its best solutions: http://spoj.sphere.pl/ranks/COINS/start=60 -- http://mail.python.org/m

Re: List of integers & L.I.S. (SPOILER)

2005-09-09 Thread n00m
PS: ALL problems in problems.PDF file (weekly updated): http://spoj.sphere.pl/problems.pdf The friendliest online contester I've ever seen! JUST A NON-SUCH. -- http://mail.python.org/mailman/listinfo/python-list

Re: List of integers & L.I.S. (SPOILER)

2005-09-10 Thread n00m
Bryan Olson wrote: > Could be. Yet you did write: >> It's incredibly fast! I just was obliged to exclaim "It's incredibly fast!" because I THOUGHT your first version handled ALL TEN testcases from the input. But the code read from the *20-lines* input *ONLY 2* its first lines. Usually they pl

Re: List of integers & L.I.S. (SPOILER)

2005-09-10 Thread n00m
a,b): for m in w: j=bisect.bisect_left(a,m) a.insert(j,m) b.insert(j,max(b[:j]+[0])+1) def n00m(n,w): a,b=[],[] oops(w,a,b) v=map(lambda x: -x, w[::-1]) c,d=[],[] oops(v,c,d) e=map(sum, zip(b, d[::-1])) mx=max(e) f=[] for i in xrang

Re: List of integers & L.I.S. (SPOILER)

2005-09-11 Thread n00m
Tim Peters; INCREDIBLE~ > 241433 2005-09-11 04:23:40 Tim Peters accepted 3.44 7096 PYTH BRAVO! I just wonder have I grey cells enough for to understand how your algo works... and hopefully it's not your last solved problem on the contester. > I'm pretty sure they're using > slower HW than mine

Re: List of integers & L.I.S. (SPOILER)

2005-09-14 Thread n00m
Tim Peters wrote: > The chance that Raymond Hettinger is going to recode _your_ > functions in C is approximately 0 ;-) Who is Raymond Hettinger? -- http://mail.python.org/mailman/listinfo/python-list

Re: List of integers & L.I.S. (SPOILER)

2005-09-14 Thread n00m
Got it! He is a kind of pythonic monsters. Btw, why it's impossible to reply to old threads? Namely, there're no more "Reply" link in them. Only "Reply to author" etc. -- http://mail.python.org/mailman/listinfo/python-list

Re: List of integers & L.I.S. (SPOILER)

2005-09-14 Thread n00m
Thank you both for your replies. And my personal "Thank you!" to Mr. Hettinger for all his tremendous work! > Perhaps because you are not using a real Usenet client? Yes! And I don't even know what is the beast - Usenet client. I just keep in Favorites of my browser (IE 6.0) this link: http://grou

Re: List of integers & L.I.S.

2005-09-16 Thread n00m
Anton, it simply does not work! Try supernumbers([2,1,4,5,3]). -- http://mail.python.org/mailman/listinfo/python-list

Re: threads/sockets quick question.

2005-09-19 Thread n00m
import socket import thread def scan(ip, port): try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((ip, port)) s.close() print '%s | %d OPEN \nscanned: %d' % (ip, port, port) except: pass ip = 'localhost' for port in range(50, 5000

Sniffing at two sockets

2005-04-26 Thread n00m
In a simple VB script I open ADODB.Connection and start sending some very simple T-SQL commands to a MS SQL Server. Like this: Set cn = CreateObject("ADODB.Connection") cn.Open _ "Provider=sqloledb;Data Source=127.0.0.1,1434;" & _ "Netw

To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
http://www.spoj.pl/problems/SUMFOUR/ 3 0 0 0 0 0 0 0 0 -1 -1 1 1 Answer for this input data is 33. My solution for the problem is == import time t = time.clock() q,w,e,r,sch,h = [],[],[],[],0,{} f = open("D:/m4000.txt","rt")

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
Your suggestion speeded it up 1.5 times (on my 4000 test input rows)! -- http://mail.python.org/mailman/listinfo/python-list

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
Steven, I ran this: import time, collections, itertools t = time.clock() q,w,e,r,sch = [],[],[],[],0 h = collections.defaultdict(itertools.repeat(0).next) f = open("D:/m4000.txt","rt") for o in range(int(f.readline())): row = map(int, f.readline().split()) q.append(row[0]) w.append(row[1

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
Paul, import time t = time.clock() f = open("D:/m4000.txt","rt") npairs = int(f.readline()) quads = [map(int, f.readline().split()) for i in xrange(npairs)] f.close() da = {} for p in quads: for q in quads: z = p[2] + q[3] da[z] = da.get(z,0) + 1 print sum(da.get(-(p[0]+q[1]),

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
Steve, imo strangely enough but your suggestion to replace "if...: else:..." with x_y = x + y h[x_y] = h.get(x_y, 1) s=l=o=w=e=d the thing by ~1 sec. -- http://mail.python.org/mailman/listinfo/python-list

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
For those who interested, my test input files: http://rapidshare.com/files/21267938/m1000.txt http://rapidshare.com/files/21268386/m4000.txt -- http://mail.python.org/mailman/listinfo/python-list

Re: To count number of quadruplets with sum = 0

2007-03-17 Thread n00m
i have no NumPy to test it... without Psyco Anton's code is the winner: ~48sec vs ~58sec of my code But with Psyco my runtime is ~28sec; Anton's - ~30sec (PC: 1.6 ghz, 512 mb) Not so bad.. keeping in mind that 256000 billions quadruplets to check :) import psyco, time psyco.full() t = time.clock(

Re: To count number of quadruplets with sum = 0

2007-03-17 Thread n00m
== RESTART === >>> 0 34.78 secs (bearophileH) >>> RESTART === >>> 0 34.77 secs (bearophileH) >>> RESTART === >>> 0 34.76 secs (bearophileH) >>> RESTART === >>>

Re: To count number of quadruplets with sum = 0

2007-03-17 Thread n00m
my dial-up line's too slow for downloading 4mb of shedskin-0.0.20.exe -- http://mail.python.org/mailman/listinfo/python-list

Re: To count number of quadruplets with sum = 0

2007-03-17 Thread n00m
>>> RESTART === >>> 0 30.4740708665 secs (Anton Vredegoor) >>> RESTART === >>> 0 30.4132625795 secs (Anton Vredegoor) >>> RESTART === >>> 0 30.4812175849 secs (Anton Vredegoor) >>> +

SHOCK: WHY None?

2007-09-21 Thread n00m
def f(i,sm): if i+1==len(a): print sm+a[i] return sm+a[i] else: f(i+1,sm+a[i]) a=[1,2,3,4,5] print f(0,0) >>> 15 None >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: Python student seeks help regex/strings

2009-04-11 Thread n00m
>>> s = 'I have 30 days to find it' >>> ss = filter(lambda si: si.isdigit(), s) >>> ss '30' >>> -- http://mail.python.org/mailman/listinfo/python-list

Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread n00m
Both codes below read the same huge(~35MB) text file. In the file > 100 lines, the length of each line < 99 chars. Stable result: Python runs ~0.65s C : ~0.70s Any thoughts? import time t=time.time() f=open('D:\\some.txt','r') z=f.readlines() f.close() print len(z) print time.time()-t m=inp

Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread n00m
fgets() from C++ iostream library??? I guess if I'd came up with "Python reads SLOWER than C" I'd get another (not less) smart explanation "why it's so". -- http://mail.python.org/mailman/listinfo/python-list

Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread n00m
>> char vs[1002000][99]; In the file 1001622(or so) records like phone number + f/l names. So the reserving makes sense, i think. Populating of vector is by zillion times slower. >> Is there an implementation of f.readlines on the internet somewhere? I was greatly surprised how fast it is. As a

Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread n00m
hdante: I run your code quite a few times. Its time = 0.734s. Of mine = 0.703-0.718s. PS All I have is an ancient Mingw compiler (~1.9.5v) in Dev-C++. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread n00m
No so simple, guys. E.g., I can't solve (in Python) this: http://www.spoj.pl/problems/INTEST/ Keep getting TLE (time limit exceeded). Any ideas? After all, it's weekend. 450. Enormous Input Test Problem code: INTEST The purpose of this problem is to verify whether the method you are using to rea

Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread n00m
I'm there since summer 2004 :) (with several time breaks) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread n00m
Btw seems all accepted pyth solutions (for this prob) used Psyco. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >