_PyLong_FromByteArray

2006-08-12 Thread Dan Christensen
My student and I are writing a C extension that produces a large integer in binary which we'd like to convert to a python long. The number of bits can be a lot more than 32 or even 64. My student found the function _PyLong_FromByteArray in longobject.h which is exactly what we need, but the

Re: numeric/numpy/numarray

2006-06-13 Thread Dan Christensen
Bryan [EMAIL PROTECTED] writes: on the python wiki NumArray is the current reimplementation of NumPy. http://wiki.python.org/moin/NumArray so, was Numarray written *before* NumPY, or was it a reimplementation of NumPy which implies it came *after* NumPy? I clarified that wiki page to

Re: list.clear() missing?!?

2006-04-12 Thread Dan Christensen
Raymond Hettinger [EMAIL PROTECTED] writes: Felipe Almeida Lessa writes: I love benchmarks, so as I was testing the options, I saw something very strange: $ python2.4 -mtimeit 'x = range(10); ' 100 loops, best of 3: 6.7 msec per loop $ python2.4 -mtimeit 'x = range(10); del

Re: list.clear() missing?!?

2006-04-11 Thread Dan Christensen
Felipe Almeida Lessa [EMAIL PROTECTED] writes: I love benchmarks, so as I was testing the options, I saw something very strange: $ python2.4 -mtimeit 'x = range(10); ' 100 loops, best of 3: 6.7 msec per loop $ python2.4 -mtimeit 'x = range(10); del x[:]' 100 loops, best of 3: 6.35

Re: timeit module: am I missing something obvious?

2006-02-20 Thread Dan Christensen
Peter Otten [EMAIL PROTECTED] writes: Steven D'Aprano wrote: When using the timeit module, you pass the code you want to time as strings: ... This is all very well, but it feels quite unnatural to me. Why am I passing strings around when functions are first class objects? Have I missed

Re: Recursive Property of Octal Numbers

2005-10-01 Thread Dan Christensen
James Stroud [EMAIL PROTECTED] writes: I'm very curious about what is going on here. I'm sure my curiosity has something to do with ignorance of some fundamental concept of computer science (maybe that 8 is just a vertical infinity?): py b = '\xb6' py b[0] '\xb6' py b[0][0] '\xb6'

Re: What language to manipulate text files

2005-06-12 Thread Dan Christensen
ross [EMAIL PROTECTED] writes: What are the ideal languages for the following examples? 1. Starting from a certain folder, look in the subfolders for all filenames matching *FOOD*.txt Any files matching in each folder should be copied to a new subfolder within the current folder called

Re: Representing ambiguity in datetime?

2005-05-18 Thread Dan Christensen
Ron Adam [EMAIL PROTECTED] writes: So it seems using 0's for the missing day or month may be how to do it. This doesn't allow more specific amounts of ambiguity. I suggest either a pair of dates, which represent the earliest and latest that the event could have been (and are equal if there is

Re: global lists

2005-05-09 Thread Dan Christensen
andrea crotti [EMAIL PROTECTED] writes: Hi everbybody again, I have a little problem, I don't understand the reason of this: a = [10,1,2,3] def foo(): global a for n in range(len(a)): a[n] = a[n]*2 If I type the above, and then call foo, I get what looks like reasonable output:

Re: pyvm -- faster python

2005-05-09 Thread Dan Christensen
djw [EMAIL PROTECTED] writes: Paul Rubin wrote: Stelios Xanthakis [EMAIL PROTECTED] writes: - The demo is an x86/linux binary only. You shouldn't trust binaries, run it in a chrooted environment not as root! Are you going to release the source? If not, it's a lot less interesting.

Re: Python Challenge ahead [NEW] for riddle lovers

2005-05-01 Thread Dan Christensen
Roel Schroeven [EMAIL PROTECTED] writes: There's no level 12 yet though. Now there's a 12 and a 13 (at least!). Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Veusz 0.5 - a scientific plotting package

2005-04-17 Thread Dan Christensen
Jeremy Sanders [EMAIL PROTECTED] writes: Veusz 0.5 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is a scientific plotting package written in Python (currently 100% Python). It uses PyQt for display and user-interfaces, and numarray

Re: preallocate list

2005-04-13 Thread Dan Christensen
Bill Mill [EMAIL PROTECTED] writes: Bill Mill [EMAIL PROTECTED] writes: I would profile your app to see that it's your append which is taking ages, but to preallocate a list of strings would look like: [This is an average length string for i in range(approx_length)] I don't think there's