[issue46978] Doc strings for built-in, in-place operators are misleading

2022-03-10 Thread Nicko van Someren
Change by Nicko van Someren : -- keywords: +patch pull_requests: +29903 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31802 ___ Python tracker <https://bugs.python.org/issu

[issue46978] Doc strings for built-in, in-place operators are misleading

2022-03-10 Thread Nicko van Someren
New submission from Nicko van Someren : Objects/typeobject.c uses slots to implement various operators and the IBSLOT macro is used to define slot entries for in-place binary operators. This macro creates a __doc__ string for the operators of the form "Return selfvalue." This

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 is

Re: Iteration for Factorials

2007-10-26 Thread Nicko
in range(1,n+1 if n = 0 else None If you don't like the rounding errors you could try: def fact(n): d = {p:1L} def f(i): d[p] *= i map(f, range(1,n+1)) return d[p] It is left as an exercise to the reader as to why this code will not work on Py3K Nicko

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,i:l[i][1]+f(f,l,l[i][0]) if l

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

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 the intersection of selections on multiple

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 constant there is in octal. 045L? Shouldn´t it be 044

Re: division by 7 efficiently ???

2007-02-02 Thread Nicko
) 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-01 Thread Nicko
. Nicko -- http://mail.python.org/mailman/listinfo/python-list

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

2006-10-04 Thread Nicko
= 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 forced the concatenated string to be computed? Cheers, Nicko -- http://mail.python.org/mailman/listinfo/python-list

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 face of such compelling reasoning, I shall have to concede

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 objects. This is true for long lists too, if you iterate

Re: python loops

2006-09-02 Thread Nicko
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
. 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 SSH with passwords is hugely more secure than telnet. Nicko -- http://mail.python.org/mailman/listinfo/python-list