Re: Sorting Large File (Code/Performance)

2008-01-25 Thread Nicko
On Jan 24, 9:26 pm, [EMAIL PROTECTED] wrote: > > If you really have a 2GB file and only 2GB of RAM, I suggest that you don't > > hold your breath. > > I am limited with resources. Unfortunately. As long as you have at least as much disc space spare as you need to hold a copy of the file then this

Re: Iteration for Factorials

2007-10-26 Thread Nicko
return d["p"] It is left as an exercise to the reader as to why this code will not work on Py3K Nicko -- http://mail.python.org/mailman/listinfo/python-list

Re: list index()

2007-09-01 Thread Nicko
On Aug 30, 7:00 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > You can also generate the files that are in one directory but ot the > other with > > (afiles | bfiles) - (afiles & bfiles) Or just (afiles ^ bfiles). Nicko -- (lambda f: lambda *a:f(f,*a))( lambda f,l,

Re: Database in memory

2007-04-10 Thread Nicko
On Apr 10, 1:10 pm, "Nicko" <[EMAIL PROTECTED]> wrote: > If you expect to do exact-match look-up where the keys are not unique > then build a dictionary containing 'set' objects which are the sets of > records which have the given key. This lets you neatly find

Re: Database in memory

2007-04-10 Thread Nicko
Jim wrote: > I have an application that will maintain an in-memory database in the > form of a list of lists. Does anyone know of a way to search for and > retreive "records" from such a structure? The answer very much depends on the manner in which you want to do the look-up. If you only need t

Re: division by 7 efficiently ???

2007-02-02 Thread Nicko
th some significant rounding errors. 9/64 is a fairly poor (6 bit) approximation of 1/7 but the principle is the same as the solution I proposed above. Nicko -- http://mail.python.org/mailman/listinfo/python-list

Re: division by 7 efficiently ???

2007-02-02 Thread Nicko
On Feb 2, 4:21 pm, "Bart Ogryczak" <[EMAIL PROTECTED]> wrote: > On Feb 1, 2:00 pm, "Nicko" <[EMAIL PROTECTED]> wrote: > > > precision and the answer that they were looking for was: > > a = (b * 045L) >> 32 > > Note that the

Re: division by 7 efficiently ???

2007-02-01 Thread Nicko
e constant there is in octal. Nicko -- http://mail.python.org/mailman/listinfo/python-list

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-04 Thread Nicko
gs(a, b, c): > return a + b + c > for i in range(1000): > x = addThreeThings("aaa", "bbb", "ccc") I note that in both of those tests you didn't actually ever realise the concatenated string. Can you give us figures for these tests having force

Re: python loops

2006-09-04 Thread Nicko
Steve Holden wrote: > Nicko wrote: > > Fredrik Lundh wrote: > >>if you cannot refrain from pulling arguments out of your ass, you not > >>really the right person to talk about hygiene. > > > > I'm impressed but your mature argument. Clearly, in the fa

Re: python loops

2006-09-03 Thread Nicko
Fredrik Lundh wrote: > Nicko wrote: > > > ... In the case of the idiom "for i in > > range(x):..." there absolutely no utility whatsoever in creating and > > recording the list of objects. > > for short lists, both objects create the *same* number of objec

Re: python loops

2006-09-02 Thread Nicko
times also on the phase of the moon) Using range() is only faster on lists so small then the cost is tiny anyway. On any substantial loop it is quite a bit slower and has been since python 2.3 Nicko -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread Nicko
not a tiny company. Most security breaches (according to the FBI/CSI computer crime survey) are perpetrated by insiders. If you log in using telnet, and have to enter passwords that allow configurations to be changed, then anyone on the local net can get those passwords. Use SSH instead. Even