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

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

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

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

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.

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

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

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

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

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

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: Running Scripts vs Interactive mode

2011-02-23 Thread n00m
Add into each your *.py script and as the very last line this: raw_input('Press any key to exit...') Or, even better, I'd recommend this free Python Editor: http://pythonide.stani.be/ SPE IDE - Stani's Python Editor Free python IDE for Windows,Mac & Linux with UML,PyChecker,Debugger, GUI design,Bl

Re: Python leaks in cyclic garbage collection

2011-02-21 Thread n00m
> Wild guess: > maybe when python exits they are called but sys.stdout has already been > closed and nothing gets written on it anymore. Certainly NOT. class Foo(): def __init__(self): self.b = Bar(self) def __del__(self): print "Free Foo" class Bar(): def __init__(

Re: Keeping track of the N largest values

2010-12-26 Thread n00m
from bisect import insort_left K = 5 top = [] while 1: x = input() if len(top) < K: insort_left(top, x) elif x > top[0]: del top[0] insort_left(top, x) print top will be enough -- http://mail.python.org/mailman/listinfo/python-list

Re: twenty years ago Guido created Python

2010-01-05 Thread n00m
Stick your English into your ass -- http://mail.python.org/mailman/listinfo/python-list

Re: twenty years ago Guido created Python

2010-01-04 Thread n00m
Ben, go away from here. With all your stupids sigs. Do you think are you original? You are a stupid animal. Guido, Tim Peters, Raymond Hettinger are geniuis. I don't know exactly Python mob. Maybe forgot someone. You is only a source of depspise for them You get your everymonth fucking 1000 e sitti

Re: twenty years ago Guido created Python

2010-01-03 Thread n00m
Now tell me: what ahat this mobs of yellow, africans, asiats, are doing in Stockholm? Do you think your govs let me in just to vist England, Norway? Never. Its all conditionally. But the fact is. IS. You roll our world into abyss of stupidity -- http://mail.python.org/mailman/listinfo/python-list

Re: Any Swisses here?

2010-01-03 Thread n00m
What Imeant by what waht try to solve e.g. http://acm.sgu.ru/problem.php?contest=0&problem=482 99% people here are 0 in this. They know this they know that, but they can't nothing, they simply are sitting on this group and apraised themselves But you can nothing -- http://mail.python.org/mailman/l

Re: twenty years ago Guido created Python

2010-01-03 Thread n00m
i'm sobered up Yes of course Guido and his lang is both superb things -- http://mail.python.org/mailman/listinfo/python-list

Re: Any Swisses here?

2010-01-02 Thread n00m
On Jan 3, 5:30 am, Steve Holden wrote: > Zhu Sha Zang wrote: > >> [stuff and nonsense from a third party] > > WTF? > > We do get the occasional bigot dropping in from time to time. Best to > ignore them 'til they go away. > > regards >  Steve > -- > Steve Holden           +1 571 484 6266   +1 800

Any Swisses here?

2010-01-02 Thread n00m
Congrats! Your choice -- to ban building of muslim mosques -- is the only choice to save our civililazation. This yellow plague (incl. Chinese etc) must be eliminated from our Planet, They are very cunning critters, they can play on strings of compassion, but its riffraffs. What do you know about R

Re: Brent's variation of a factorization algorithm

2009-12-10 Thread n00m
On Dec 10, 2:59 am, Irmen de Jong wrote: > On 12/10/09 12:52 AM, n00m wrote: > > > On Dec 10, 1:11 am, Irmen de Jong  wrote: > >> 9 > >> == 27 * 37037037 > > >> What gives? Isn't this thing supposed to factor numbers into the product >

Re: Brent's variation of a factorization algorithm

2009-12-10 Thread n00m
On Dec 10, 1:11 am, Irmen de Jong wrote: > 9 > == 27 * 37037037 > > What gives? Isn't this thing supposed to factor numbers into the product > of two primes? > > -irmen Only if you yield to it a SEMIprime =) > 27 * 37037037 Now you can apply brent() to these numbers, and so on -- http://

Re: Brent's variation of a factorization algorithm

2009-12-10 Thread n00m
PPS The code was successfully tested e.g. here: http://www.spoj.pl/ranks/FACT1/ (see my 2nd and 4th places). They confused versions: the 2nd is in Python 2.5, not 2.6.2. PPPS Funnilly... almost only Python on the 1st page =) -- http://mail.python.org/mailman/listinfo/python-list

Re: Brent's variation of a factorization algorithm

2009-12-09 Thread n00m
Being an absolute dummy in Theory of Number for me ***c'est fantastique*** that brent() works =) PS 1. Values of magic parameters c = 11 and m = 137 almost don't matter. Usually they choose c = 2 (what about to run brent() in parallel with different values of "c" waiting for "n" is cracked?) 2. B

Re: Trying to understand += better

2009-11-30 Thread n00m
> The first statement is creating a whole new list; Yes but *imo* not quite exactly so. We can't think of 2 lists as of absolutely independent things. ... x = [[0]] ... id(x) 19330632 ... id(x[0]) 19316608 ... z = x + [3] ... id(z) 19330312 ... id(z[0]) 19316608 ... ... z[0] is x[0] # ? True ...

Re: Sorting: too different times. Why?

2009-11-30 Thread n00m
> Some sexually transmitted diseases make your genitals drip. I suspected this :-) Eminem is a famous misogynist -- http://mail.python.org/mailman/listinfo/python-list

Re: Can "self" crush itself?

2009-11-30 Thread n00m
Ok ok Of course, it's a local name; -- just my silly slip. And seems it belongs to no dict[]... Just an internal volatile elf -- http://mail.python.org/mailman/listinfo/python-list

Re: Can "self" crush itself?

2009-11-30 Thread n00m
> Why would you want to do that in the first place? I don't know... :-) As Schoepenhauer put it: The man can do what he wants to do but he can't want to want what he wants to do -- http://mail.python.org/mailman/listinfo/python-list

Brent's variation of a factorization algorithm

2009-11-30 Thread n00m
Maybe someone'll make use of it: def gcd(x, y): if y == 0: return x return gcd(y, x % y) def brent(n): c = 11 y, r, q, m = 1, 1, 1, 137 while 1: x = y for i in range(1, r + 1): y = (y * y + c) % n k = 0 while 1:

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread n00m
On Nov 29, 11:43 pm, Bearophile wrote: > Anyway, you may try a pure-Python2.x > implementation:http://suffixtree.googlecode.com/files/suffixtree-0.1.py Ouch, Bearie... 214 lines of code are there. Ok.. I tested it. Firstly I replaced all "print " with "pass##print " (aiming to avoid intensive pr

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread n00m
Tested both my codes against a random string of length = 1. === from random import choice s = '' for i in xrange(1): s += choice(('a','b','c','d','e','f')) === C++: ~0.28s Python: ~0.48s PS I suspect th

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread n00m
http://en.wikipedia.org/wiki/Suffix_tree Looks not very friendly appealing :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread n00m
On Nov 29, 3:15 pm, Bearophile wrote: > Maybe in your C++ code there's something that can be improved, this is > a 1:1 translation to D (V.1) language (using dlibs) and it's about 2.2 > times faster than the Psyco version:http://codepad.org/MQLj0ydB > Using a smarter usage of memory (that is avoid

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread n00m
This worked out in 5.28s Imo it's not that *much* slower (of course, Psyco can't help here) === import itertools def subs(s): return len(set(itertools.chain( s[i:j] for i in xrange(len(s)) for j in xrange(i, len(s)+1 - 1 from time i

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread n00m
My Py solution: = import psyco psyco.full() def foo(s): n = len(s) s = s + ' ' a = [[] for i in xrange(128)] ans = 0 for i in xrange(n - 1, -1, -1): lev = 0 for st in xrange(len(a[ord(s[i])]) - 1, -1, -1):

Re: Python Programming Challenges for beginners?

2009-11-28 Thread n00m
PS My straightforward C++ solution got TLE... #include #include #include #include #include #include #include #include #include using namespace std; int main() { //freopen("88.txt", "rt", stdin); //freopen("99.txt", "wt", stdout); int tcs; string s; cin >> tcs; whi

Re: Python Programming Challenges for beginners?

2009-11-28 Thread n00m
On Nov 28, 8:24 pm, Lie Ryan wrote: > Now, this makes me interested. How efficient it would be when len(s) == > 1... might as well write it and see. Take back what I said, give me > a minute... ... and you can check it here: http://www.spoj.pl/problems/DISUBSTR/ I see there only one (accepted

Re: Python Programming Challenges for beginners?

2009-11-27 Thread n00m
On Nov 27, 6:00 pm, Paul Rudin wrote: > efficiency ... This is it! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Programming Challenges for beginners?

2009-11-27 Thread n00m
> abba > bbaz> abbaz > > == > > Answer: 11 > > Answer: 13- Hide quoted text - 14 ! with '' (empty substring :-)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Programming Challenges for beginners?

2009-11-27 Thread n00m
On Nov 27, 1:22 pm, Jon Clements wrote: > Of course, if you take '~' literally (len(s) <= -10001) I reckon > you've got way too many :) > > Jon. Then better: len(s) < abs(~1) PS It's a hard problem; so let's leave it alone -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Programming Challenges for beginners?

2009-11-27 Thread n00m
> You're missing some sub-strings. Yes! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Programming Challenges for beginners?

2009-11-26 Thread n00m
On Nov 27, 5:24 am, astral orange <457r0...@gmail.com> wrote: [skip] How about the next problem: you are given string "s" (len(s) <= ~1), in the string only letters 'a'..'z' Task: to count the number of all *different* substrings of "s" Example: s = 'abbaz' Its different substrings are: a b z

Re: Can "self" crush itself?

2009-11-25 Thread n00m
aaah... globals()... Then why "self" not in globals()? class Moo: cnt = 0 def __init__(self, x): self.__class__.cnt += 1 if self.__class__.cnt < 3: self.x = x else: print id(self) for item in globals().items(): pr

Re: Can "self" crush itself?

2009-11-25 Thread n00m
> Or just raise an exception in __init__(),.. Then we are forced to handle this exception outside of class code. It's Ok. Never mind. Next thing. I can't understand why we can get __name__, but not __dict__, on the module level? print __name__ print __dict__ >>> =

Re: Can "self" crush itself?

2009-11-25 Thread n00m
Then how can we destroy the 3rd instance, right after its creation and from inside class Moo code? class Moo: cnt = 0 def __init__(self, x): self.x = x self.__class__.cnt += 1 if self.__class__.cnt > 2: print id(self) ## 13406816

Re: Can "self" crush itself?

2009-11-24 Thread n00m
> Whatever you rebind ‘self’ to inside the function... Seems you are right! Thanks, Ben, for the lesson :-) class Moo: cnt = 0 def __init__(self, x): self.x = x self.__class__.cnt += 1 if self.__class__.cnt > 2: self.crush_me() def crush_me(self)

Can "self" crush itself?

2009-11-24 Thread n00m
Why does "h" instance stay alive? class Moo: cnt = 0 def __init__(self, x): self.x = x self.__class__.cnt += 1 if self.__class__.cnt > 2: self.crush_me() def crush_me(self): print 'Will self be crushed?' self = None f = Moo(1) g = Mo

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
> it's somewhat unnatural to say "too different xs" Aha. Thanks. PS For years I thought that song's title "No Woman No Cry" by Bob Marley means "No Woman -- No Cry". As if a man got rid of his woman and stopped crying, out of her bad behaviour etc. It turned out to mean "No, woman,.. no cry..." O

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
:-) Of course, by "too" I meant "too", as in "to much" -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
Here "meaningful order" is: if elephant "a[i]" is smarter than elephant "a[j]" then "i" must be strictly less than "j" Of course, to the same effect we could sort them simply by sizes, but then time of sorting would increase by ~ 2 times -- due to decreasing of number of equally smart things. But

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
> The second part of the compound if is backwards.  So if this is headed > for production code, it better get fixed. > > DaveA Not sure I'm understanding your remark. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
> Do you get the same magnitude difference > if you make Vector a new-style class? Yes (I mean "No"): new-style's much faster And now it's elephants instead of vectors. Def: an elephant is smarter than another one IIF its size is strictly less but its IQ is strictly greater I.e. you can't compar

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
I was expecting the 1st method would be *slower* than the 2nd one :-) Or at least equal... Just random ("intuitive") expectations -- http://mail.python.org/mailman/listinfo/python-list

Sorting: too different times. Why?

2009-11-22 Thread n00m
Any comment: class Vector: def __init__(self, x, y): self.x = x self.y = y def __cmp__(self, v): if self.x < v.x and self.y > v.y: return -1 return 0 def v_cmp(v1, v2): if v1.x < v2.x and v1.y > v2.y: return -1 return 0 from ran

Re: What do I do now?

2009-10-13 Thread n00m
I'm going to develop further my py. script for text detection and localization in raster images: http://funkybee.narod.ru/ Slow Doe... -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-08 Thread n00m
N00m The Instigator... hahaha :-) I always wish I was a producer, an entertainer, an impressario, or even a souteneur (kidding). Life is complex: it has both real and imaginary parts. Some producer (Mr. Gomelsky) nicknamed Eric Clapton as "Slow Hand", many years ago. Gomel is my nativ

Re: Enormous Input and Output Test

2009-10-08 Thread n00m
Congrats, Irmen. PS > so I think 7.5 seconds for the fastest ... It's becoming crazy :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-08 Thread n00m
numerix's solution was excelled by Steve C's one (8.78s): http://www.spoj.pl/ranks/INOUTEST/lang=PYTH I don't understand nothing. -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-06 Thread n00m
What happened to performance of ver.2.6.2 (vs ver.2.5.x)? https://www.spoj.pl/forum/viewtopic.php?f=20&t=5949 -- http://mail.python.org/mailman/listinfo/python-list

Re: How to sort a list of strings on a substring

2009-10-06 Thread n00m
Here you are: LogList = [\ "inbound tcp office 192.168.0.125 inside 10.1.0.91 88", "inbound tcp office 192.168.0.220 inside 10.1.0.31 2967", "inbound udp lab 172.24.0.110 inside 10.1.0.6 161", "inbound udp office 192.168.0.220 inside 10.1.0.13 53"] LogList.sort(key=lambda x: x[x.

Re: Enormous Input and Output Test

2009-10-06 Thread n00m
> This takes 5 second on my machine using a file with 1,000,000 random... Surely it will fail to pass time limit too -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-06 Thread n00m
> 50-80%% of users from the 1st page in ranklist are > super-extra-brilliant #5 there: http://www.spoj.pl/users/tourist/ This 14 y.o. schoolboy won IOI 2009, in this August, and he's about to get into Guiness' book as the youngest winner for all the history of international olympiads on informatic

Re: How to sort a list of strings on a substring

2009-10-05 Thread n00m
In my early teen, school years "Let It Be" by The Beatles sounded for my ears (incredibly clearly and obviously!) as "Lia Ri Pip". In school I studied French, English only many years later. My inner translation of "Here you are!" is smth like "Catch it!", "Take it!", "Look at this!" etc -- http:/

Re: How to sort a list of strings on a substring

2009-10-05 Thread n00m
English language is not my mother toung, so I can't grasp many subtle nuances of it. Maybe "here you are" means to me quite a different thing than to you. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to sort a list of strings on a substring

2009-10-05 Thread n00m
> No, that's incorrect. Try it with this data and you will see it fails: Of course, you are right, but I think the topic-starter is smart enough to understand that I suggested only a hint, a sketch, a sample of how to use "key=" with "lambda", not a ready-to-apply solution. -- http://mail.python.

Re: Enormous Input and Output Test

2009-10-05 Thread n00m
Duncan Booth, alas... still TLE: 2800839 2009-10-04 13:03:59 Q Enormous Input and Output Test time limit exceeded - 88M PYTH -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-05 Thread n00m
> but unlike us, he's routinely under 11s. Crazy. No wonder! 50-80%% of users from the 1st page in ranklist are super-extra-brilliant (young students) programmers. They are winners of numerous competitions, national and international olympiads on informatics, etc. Some of them are/were even true

Re: regex (?!..) problem

2009-10-04 Thread n00m
Why not check it simply by "count()"? >>> s = '1234C156789' >>> s.count('C1') 1 >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-04 Thread n00m
It can be not so "simple". There can be multiple input files, with *total* size ~30-50-80 MB. -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-04 Thread n00m
This time limits too: = import psyco psyco.full() import sys def foo(): ##sys.stdin = open('D:/1583.txt', 'rt') a = sys.stdin.readlines() a = a[1:int(a[0]) + 1] for ai in a: x, y = ai.split() sys.stdout.write(str

Re: Enormous Input and Output Test

2009-10-04 Thread n00m
PS Yes, they support psyco since long time ago (otherwise I'd get Compilitation Error verdict). I used Psyco there many many times. -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-04 Thread n00m
I've given up :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
And this code time limits (no matter with or without Psyco): import psyco psyco.full() import sys def foo(): ##sys.stdin = open('D:/1583.txt', 'rt') sys.stdin.readline() while 1: try: x, y = sys.stdin.readline().split() sys.stdout.write(str(int(x) * in

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
And *without* Psyco the above code gets TLE verdict... A kind of mystery :( -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
> On my machine, the above code handles ~50MB in ~10sec. Means their input > 40-50MB 2. I just see: two guys did it in Python and I feel myself curious "how on earth?". -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >