Re: How to display Chinese in a list retrieved from database via python

2008-12-27 Thread Gabriel Genellina
En Sat, 27 Dec 2008 03:03:24 -0200, zxo102 escribió: On 12月26日, 下午3时16分, "Mark Tolonen" wrote: I was able to display 中文 successfully with this code: f=open('test.html','wt') f.write(''' test \xd6\xd0\xce\xc4''') f.close() Mark, I have exactly copied your code into the htdocs of my Apa

Re: I always wonder ...

2008-12-27 Thread Pierre-Alain Dorange
r wrote: > > > Go to Google groups... it looks perfect :) > > > > It's a usenet group here, nothing to do with google groups. > > To get back to the group subject, what is your actual python projects ? > > I am crusading to bring python scripting to Google SketchUp, do want > to get on board? I

Re: multiply each element of a list by a number

2008-12-27 Thread MVP
Hi! map(multby3, (1, 2, 3, )) ...with lambda: map(lambda x: x*3, [1,2,3]) @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a locked buffer from objects (PEP 3118)

2008-12-27 Thread Stefan Behnel
KKH wrote: > it seems the whole locking-theme has gone from PEP 3118 (PyBUF_LOCK is > gone). Yet the string and byte objects seem to provide locked buffers > through PyArg_Parse arguments s*, y* and z* (documentation says so). Might be a left-over. All locking the buffer interface itself provides

Parsing a sitemap library?

2008-12-27 Thread Sam
Hi... I see an awful lot of code out there to create sitemaps using Python. But I can't find anything to consume sitemaps using Python. Is there a library to convert sitemaps and sitemap indexes of sitemaps into something more Pythonic? I know I can write one pretty easily using e.g. Beautiful

parsing csv files class

2008-12-27 Thread alex goretoy
Hello All, I have this class that I use in one of my projects. I know it's missing functionality and some things could have been done differently. Can you ehlp me make this class better? What can I do to make it more resistant to error? You can find the stdout_colours class on Google if you want i

Re: parsing csv files class

2008-12-27 Thread alex goretoy
I know it's messy with all those self.soc.* functions, but it works in one of my current project. I just want to make it more pythonic I also want to add capability for makeing csv file if I give it input like: 1234,something nice, hey this is something nice 2468,something else, something else On

Re: Is there a function to remove escape characters from a string ?

2008-12-27 Thread Stef Mientki
Steven D'Aprano wrote: On Sat, 27 Dec 2008 01:41:40 +0100, Stef Mientki wrote: Sorry if I offended someone, that was certainly not my intention. And I guess you will be surprised, if I tell you, I don't (want) to understand any bit of the above code ;-) Come on, the home computer was invente

Re: tkinter 3.0 multiple keyboard events together

2008-12-27 Thread janislaw
On 26 Gru, 17:44, Pavel Kosina wrote: > janislaw napsal(a): > > > On 26 Gru, 05:52, Pavel Kosina wrote: > > >> Is it possible to catch in an event more that one key from keyboard? In > >> my code, I can handle always the only one, the first I press, the others > >> are omitted. Say, I press both

Re: ctypes & strings

2008-12-27 Thread Hendrik van Rooyen
Red Rackham wrote: >I would like to pass a string into a dll function. I notice that to pass using ctypes, it has to be a ctypes type. >Looking at the ctypes doc page I don't see a c_string class. The following seems to work for me: In the c programme: /* This routine outputs and inputs

Re: parsing csv files class

2008-12-27 Thread Gary M. Josack
alex goretoy wrote: I know it's messy with all those self.soc.* functions, but it works in one of my current project. I just want to make it more pythonic I also want to add capability for makeing csv file if I give it input like: 1234,something nice, hey this is something nice 2468,something e

Re: tkinter 3.0 multiple keyboard events together

2008-12-27 Thread Pavel Kosina
janislaw napsal(a): Use google to find the appropriate site, or browse this site, there are plenty of examples. You may want to examine the code I wrote to you to catch the idea: #-- import Tkinter import pprint tk = Tkinter.Tk() f = Tkinter.Frame(tk, width=100, height=100) m

Re: dummy needs help with Python

2008-12-27 Thread Tim Chase
I am trying to find somebody who can give me a simple python program I can use to "program by analogy". I just want to read two CSV files and match them on several fields, manipulate some of the fields, and write a couple of output files. ... Please forgive me if this is so, and take pity on

www.iofferkicks.com china cheap wholesale nike shoes,air jordan shoes,air force one shoes.

2008-12-27 Thread www.iofferkicks.com
Get Nike Shoes at Super Cheap Prices Discount Nike air jordans (www.iofferkicks.com) Discount Nike Air Max 90 Sneakers (www.iofferkicks.com) Discount Nike Air Max 91 Supplier (www.iofferkicks.com) Discount Nike Air Max 95 Shoes Supplier (www.iofferkicks.com) Discount Nike Air Max 97 Trainers (

Initializing GHC from Python

2008-12-27 Thread Ron de Bruijn
Hi, We have just published a small article on how one can initialize GHC from Python, with only optional use of C. You can read it at http://gamr7.com/blog/?p=65 . Best regards, Ron de Bruijn -- http://mail.python.org/mailman/listinfo/python-list

Re: I always wonder ...

2008-12-27 Thread Hendrik van Rooyen
"Carl Banks" wrote: >If you have to followup, at least keep your reply to something short >and witty, like, "Go away, troll". OK will do see next post. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's popularity (a bit OT)

2008-12-27 Thread Hendrik van Rooyen
"r" wrote: >I think you missed my point Steven, I was in no way proud of the fact >of my 9th place rating. It just proves my point to the small following >of this group. And frankly makes me feel bad. This spurt of high frequency posts is something that seems to happen to most newcomers to the g

Re: anagram finder / dict mapping questi

2008-12-27 Thread 7068316797
-- http://mail.python.org/mailman/listinfo/python-list

Test message - please ignore

2008-12-27 Thread skip
Working on the spam filter. Please ignore... S -- http://mail.python.org/mailman/listinfo/python-list

Test message - please ignore

2008-12-27 Thread Skip Montanaro
Test post via gmane. Please ignore. -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes & strings

2008-12-27 Thread Mark Tolonen
"Hendrik van Rooyen" wrote in message news:000f01c96822$5c300f00$0d00a...@hendrik... Red Rackham wrote: I would like to pass a string into a dll function. I notice that to pass using ctypes, it has to be a ctypes type. >Looking at the ctypes doc page I don't see a c_string class. The

Test message via Google Groups

2008-12-27 Thread Skip Montanaro
Test message - please ignore. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing csv files class

2008-12-27 Thread Chris Rebert
On Sat, Dec 27, 2008 at 5:02 AM, Gary M. Josack wrote: > alex goretoy wrote: >> >> I know it's messy with all those self.soc.* functions, but it works in one >> of my current project. I just want to make it more pythonic I also want to >> add capability for makeing csv file if I give it input like

Re: ctypes & strings

2008-12-27 Thread Gabriel Genellina
En Sat, 27 Dec 2008 10:54:32 -0200, Hendrik van Rooyen escribió: The c routine will actually break Python's normal string immmutability and give you back a changed ins. ...so don't do that! If you require a mutable string to pass to C functions, use ctypes.create_string_buffer() It is

[2.4.4] creating a datetime.datetime from an XML xs:dateTime

2008-12-27 Thread Martin
Hi, subject says it all. I'd like to create a python datetime.datetime from an xs:string[1] I know about time.strptime and could get to a datetime.datetime from there, but that would be error prone like: * are there time zones? * how is the year represented * etc, yadda yadda so I'd rather l

Re: parsing csv files class

2008-12-27 Thread Gabriel Genellina
En Sat, 27 Dec 2008 11:02:13 -0200, Gary M. Josack escribió: alex goretoy wrote: I know it's messy with all those self.soc.* functions, but it works in one of my current project. I just want to make it more pythonic I also want to add capability for makeing csv file if I give it input lik

Re: [2.4.4] creating a datetime.datetime from an XML xs:dateTime

2008-12-27 Thread skip
martin> subject says it all. I'd like to create a python martin> datetime.datetime from an xs:string[1] ... martin> so I'd rather like to find some method (hopefully within the martin> standard lib) that had more peer review than only me :). Not in the standard lib, but you mi

Re: tkinter 3.0 multiple keyboard events together

2008-12-27 Thread janislaw
On 27 Gru, 15:08, Pavel Kosina wrote: > janislaw napsal(a): > > Use google to find the appropriate site, or browse this site, there > > are plenty of examples. You may want to examine the code I wrote to > > you to catch the idea: > > #-- > > import Tkinter > > import pprint >

Re: [2.4.4] creating a datetime.datetime from an XML xs:dateTime

2008-12-27 Thread Martin
Hi, 2008/12/27 : > Not in the standard lib, but you might want to check out the dateutil > package. Its dateutil.parser module does an excellent job parsing a wide > range of time formats. It's a bit weak in the timezone area though. is that http://labix.org/python-dateutil, I'll have a look

[OT] game engine (as in rules not graphics)

2008-12-27 Thread Martin
Hello, I'd like to get in touch with game development a bit. I'm not talking about graphics but rather the game rules itself. Something like http://en.wikipedia.org/wiki/Monopoly_(game)#Rules, is there even a general approach to that or should I just go sketch up my rules and try to implement them

Re: [2.4.4] creating a datetime.datetime from an XML xs:dateTime

2008-12-27 Thread skip
martin> is that http://labix.org/python-dateutil, I'll have a look at martin> it. Yup. PyPI: http://pypi.python.org/pypi/python-dateutil/1.4.1 Skip -- http://mail.python.org/mailman/listinfo/python-list

C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
I'm trying to write an extension module in C which contains a single function with the following prototype: void func( int N, int * arg1, int * arg2, int * ret ); Here arg1 and arg2 are length N arrays, and the function computes ret which is also an N length array. From python I'd like to call th

Re: Python 3 and my Mac (Leopard)

2008-12-27 Thread scott
Dan wrote: Wanted to learn python, got Mark Summerfield's new book "Programming in Python 3". Having a hard time getting python 3 and IDLE working on my Mac with Leopard. The mac "resources" on the python.org site seem a bit out of date, and don't really mention python 3. Are there any resou

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Scott David Daniels
Daniel Fetchinson wrote: I'm trying to write an extension module in C which contains a single function with the following prototype: void func( int N, int * arg1, int * arg2, int * ret ); Here arg1 and arg2 are length N arrays, and the function computes ret which is also an N length array. Fr

Re: multiply each element of a list by a number

2008-12-27 Thread Colin J. Williams
Méta-MCI (MVP) wrote: Hi! map(multby3, (1, 2, 3, )) with lambda: map(lambda x: x*3, [1,2,3]) @-salutations More lines but perhaps faster than numpy: PythonWin 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2008 Mark Hammo

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>> I'm trying to write an extension module in C which contains a single >> function with the following prototype: >> void func( int N, int * arg1, int * arg2, int * ret ); >> Here arg1 and arg2 are length N arrays, and the function computes ret >> which is also an N length array. From python I'

Re: multiply each element of a list by a number

2008-12-27 Thread skip
Colin> ... perhaps faster than numpy: ... For extremely short lists, but not for much else: % for n in 1 10 100 1000 1 10 ; do > echo "len:" $n > echo -n "numpy: " > python -m timeit -s 'import numpy ; a = numpy.array(range('$n'))' 'a*3' > echo -n "lis

Re: parsing csv files class

2008-12-27 Thread alex goretoy
It's main concern is to grab the file into the buffer for use in other classes. The self.soc.me_him is just so I know when its ENTERING or EXITING in that function when I run it in terminal. It's prints it in color. My main concern right now is to add error handling. I'm still learning how to use a

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Scott David Daniels
Daniel Fetchinson wrote: I have considered using ctypes but for my needs using the C API directly seems more reasonable. array.array and numpy.array doesn't fit my needs since I need to do long and complicated operations on the two (pretty large) integer arrays that would be too slow using array.

Re: parsing csv files class

2008-12-27 Thread alex goretoy
I might as well add a UnicodeReader and UnicodeWriter and support for passing delimiter in from other classes. At the same time. Anyone have a good csv class I can pick thru? I'm planning on posting my mysql adn curl classes that I use in my projects I just want to make them better and have less e

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>> I have considered using ctypes but for my needs using the C API >> directly seems more reasonable. array.array and numpy.array doesn't >> fit my needs since I need to do long and complicated operations on the >> two (pretty large) integer arrays that would be too slow using >> array.array and nu

how to make a class to get all forms and input fields from webpage

2008-12-27 Thread alex goretoy
Hello All, How do I make a class for retrieving all forms and input fields on a web page. Meaning, form name, form url,all input fields, text,textarea,select,etc...I have something currently and it kinda works. It also kinda works for retrieving all images on webpages. My main concer here is to ma

math module for Decimals

2008-12-27 Thread jerry . carl . mi
Hi, I have been looking for a Python module with math functions that would both eat and spit Decimals. The standard math module eats Decimals allright but spits floats... herefore exp(sin(Decimal())) produces exp () of a float :-( So far, i found: -AJDecimalMathAdditions (http://www.ajgs.com/pro

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Scott David Daniels
Daniel Fetchinson wrote: I have a list to begin with which will be passed to the C function. > I assume converting the list to an array.array and passing that to the C function doesn't make any difference in terms of speed since the operation itself will be done in the C function anyway.

Re: ctypes & strings

2008-12-27 Thread Aaron Brady
On Dec 27, 2:03 pm, "Gabriel Genellina" wrote: > En Sat, 27 Dec 2008 10:54:32 -0200, Hendrik van Rooyen   > escribió: > > > The c routine will actually break Python's normal string > > immmutability and give you back a changed ins. > > ...so don't do that! > If you require a mutable string to pas

Re: game engine (as in rules not graphics)

2008-12-27 Thread Aaron Brady
On Dec 27, 3:02 pm, Martin wrote: > Hello, > > I'd like to get in touch with game development a bit. I'm not talking > about graphics but rather the game rules itself. Something > likehttp://en.wikipedia.org/wiki/Monopoly_(game)#Rules, is there even a > general approach to that or should I just g

Re: parsing csv files class

2008-12-27 Thread alex goretoy
How would I change this to work with numpy: (Would it be more feasible for storing big files? 300-30,000 records) for row in reader: self.buffer.append(row) s,a=[],{} for j in range(len(self.buffer[0])): a[self.bu

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Robert Kern
Daniel Fetchinson wrote: I agree that array.array is more efficient than a list but the input for my function will come from PIL and PIL returns a list. So I have a list to begin with which will be passed to the C function. With recent versions of PIL, numpy can create an array from an Image v

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>> I agree that array.array is more efficient than a list but the input >> for my function will come from PIL and PIL returns a list. So I have a >> list to begin with which will be passed to the C function. > > With recent versions of PIL, numpy can create an array from an Image very > quickly, po

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Aaron Brady
On Dec 27, 6:06 pm, Scott David Daniels wrote: > Daniel Fetchinson wrote: > > I have a list to begin with which will be passed to the C function. > >  > I assume converting the list to an array.array and passing that to the C > > > function doesn't make any difference in terms of speed since t

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
On 12/27/08, Robert Kern wrote: > Daniel Fetchinson wrote: > >> I agree that array.array is more efficient than a list but the input >> for my function will come from PIL and PIL returns a list. So I have a >> list to begin with which will be passed to the C function. > > With recent versions of P

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Gabriel Genellina
En Sat, 27 Dec 2008 22:54:52 -0200, Daniel Fetchinson escribió: This is the function I have, the corresponding python function will take two equal length lists of integers and the C function will compute their sum and return the result as a python tuple. static PyObject *func( PyObject * se

Re: Is there a function to remove escape characters from a string ?

2008-12-27 Thread Martin
2008/12/27 Stef Mientki : > Steven D'Aprano wrote: >> No, that only makes it even more confusing. What does Moore's Law have to >> do with your willful ignorance about the existence of human languages other >> than English? >> > Nothing. > I even don't (want to) see what bits / bytes / escape seque

Re: math module for Decimals

2008-12-27 Thread Gabriel Genellina
En Sat, 27 Dec 2008 22:02:51 -0200, escribió: I have been looking for a Python module with math functions that would both eat and spit Decimals. The standard math module eats Decimals allright but spits floats... herefore exp(sin(Decimal())) produces exp () of a float :-( Which math functions

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Robert Kern
Daniel Fetchinson wrote: I agree that array.array is more efficient than a list but the input for my function will come from PIL and PIL returns a list. So I have a list to begin with which will be passed to the C function. With recent versions of PIL, numpy can create an array from an Image ver

Re: how to make a class to get all forms and input fields from webpage

2008-12-27 Thread Gabriel Genellina
En Sat, 27 Dec 2008 21:54:02 -0200, alex goretoy escribió: How do I make a class for retrieving all forms and input fields on a web page. Meaning, form name, form url,all input fields, text,textarea,select,etc...I have something currently and it kinda I'd use BeautifulSoup: http://pypi.pyth

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>> This is the function I have, the corresponding python function will >> take two equal length lists of integers and the C function will >> compute their sum and return the result as a python tuple. >> >> >> static PyObject *func( PyObject * self, PyObject * args ) >> { >> int j, N; >> int

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
I agree that array.array is more efficient than a list but the input for my function will come from PIL and PIL returns a list. So I have a list to begin with which will be passed to the C function. >>> With recent versions of PIL, numpy can create an array from an Image very >>> qui

Re: ctypes & strings

2008-12-27 Thread Gabriel Genellina
En Sat, 27 Dec 2008 22:06:23 -0200, Aaron Brady escribió: On Dec 27, 2:03 pm, "Gabriel Genellina" wrote: En Sat, 27 Dec 2008 10:54:32 -0200, Hendrik van Rooyen   escribió: > The c routine will actually break Python's normal string > immmutability and give you back a changed ins. Hmmm, I do

Re: Python 3 and my Mac (Leopard)

2008-12-27 Thread Kevin Walzer
Dan wrote: Wanted to learn python, got Mark Summerfield's new book "Programming in Python 3". Having a hard time getting python 3 and IDLE working on my Mac with Leopard. The mac "resources" on the python.org site seem a bit out of date, and don't really mention python 3. Are there any resou

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Gabriel Genellina
En Sun, 28 Dec 2008 00:40:52 -0200, Daniel Fetchinson escribió: You MUST check EVERY function call for errors! Yes, I know :) Believe me, if you don't, there is a risk of crashing the program. And they're a lot harder to find and fix. And check the argument's type (how do you know i

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>> This is the function I have, the corresponding python function will >> take two equal length lists of integers and the C function will >> compute their sum and return the result as a python tuple. >> >> >> static PyObject *func( PyObject * self, PyObject * args ) >> { >> int j, N; >> int

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>>> You MUST check EVERY function call for errors! >> >> Yes, I know :) >> > > Believe me, if you don't, there is a risk of crashing the program. And > they're a lot harder to find and fix. Sure, what I meant by the smiley is just that it was a quick and dirty example, not real code. In a real cod

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Ivan Illarionov
On Dec 28, 12:45 am, "Daniel Fetchinson" wrote: > I'm trying to write an extension module in C which contains a single > function with the following prototype: > > void func( int N, int * arg1, int * arg2, int * ret ); > > Here arg1 and arg2 are length N arrays, and the function computes ret > whi

assignment with [:]

2008-12-27 Thread Ben Bush
Hi, I saw this line of code on a recent post: a1[:] = [x*3 for x in a1] Could somebody tells me what the [:] means? I can't find it anywhere. See context below if needed: On Dec 26, 4:46 pm, Tim Chase wrote: > > What does *not* work is > > 3 * [0,1,2] > > As you know, this gives > >

Re: how to make a class to get all forms and input fields from webpage

2008-12-27 Thread RP
Thank you. On Sat, Dec 27, 2008 at 8:39 PM, Gabriel Genellina wrote: > En Sat, 27 Dec 2008 21:54:02 -0200, alex goretoy < > aleksandr.gore...@gmail.com> escribió: > > How do I make a class for retrieving all forms and input fields on a web >> page. Meaning, form name, form url,all input fields,

Re: assignment with [:]

2008-12-27 Thread Robert Kern
Ben Bush wrote: Hi, I saw this line of code on a recent post: a1[:] = [x*3 for x in a1] Could somebody tells me what the [:] means? I can't find it anywhere. It's a slice assignment. When both the start and stop arguments are omitted, it refers to the entire sequence. In this case, it means

Re: strange behavior of math.sqrt() in new 3.0 version

2008-12-27 Thread Tim Roberts
Scott David Daniels wrote: > >I avoid using single-letter variables except where I know the types >from the name (so I use i, j, k, l, m, n as integers, s as string, >and w, x, y, and z I am a little looser with (but usually float or >complex). It's amazing to me that Fortran continues to live on

Re: math.sqrt() in new 3.0 version : solution in input()

2008-12-27 Thread Tim Roberts
David Lemper wrote: > >I cannot find a mention of this in "The Python Tutorial >release 3.1" The I&O section discusses output formatting >and reading & writing text files. >John pointed out its in Guido's "What's New in Python3.0" >Indeed its mentioned in PEP 3111, near end of What's New >and s

Re: parsing csv files class

2008-12-27 Thread Tim Roberts
"alex goretoy" wrote: > >class parsercsvy(object): >"""Return a line from a csv file or total amount of lines""" >def __init__(self,file_name=""): >self.func_me_color="white_on_black" >self.soc=stdout_colours.stdout_colors() >self.soc.me_him(['ENTER:',__name__],self

Re: math module for Decimals

2008-12-27 Thread jerry . carl . mi
> Which math functions? ln, log10, exp, sqrt already exist as methods of   > Decimal instances. At the end of the Decimal docs there are a few   > examples, including computing sin and cos (but apparently they naïvely use   > a McLaurin series like you noticed in other module). Hi Gabriel - than

Need help getting MoinMoin to run under WSGI

2008-12-27 Thread Ron Garret
I successfully installed MoinMoin as a CGI according to the instructions on the moinmo.in site. But when I tried to switch over to running it under wsgi it failed thusly: [Sat Dec 27 21:44:14 2008] [error] [client 66.214.189.2] Traceback (most recent call last): [Sat Dec 27 21:44:14 2008] [err

Re: math module for Decimals

2008-12-27 Thread Steven D'Aprano
On Sat, 27 Dec 2008 16:02:51 -0800, jerry.carl.mi wrote: > Hi, > > I have been looking for a Python module with math functions that would > both eat and spit Decimals. The standard math module eats Decimals > allright but spits floats... herefore exp(sin(Decimal())) produces exp > () of a float :

python and rcp, portbind communication

2008-12-27 Thread Marco
Hello python list, i want to write a program in python which can communicate with rpcservices. At the first stage it shall talk with portbind on port 111 and figure out the running rpc services. Is there already a implementation for python to do so? Best regards, marco -- http://mail.python.org/

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Gabriel Genellina
En Sun, 28 Dec 2008 01:47:08 -0200, Daniel Fetchinson escribió: As others already said, using a Numpy array or an array.array object would be more efficient (and even easier - the C code gets a pointer to an array of integers, as usual). I looked for this in the C API docs but couldn't

Re: math module for Decimals

2008-12-27 Thread Steven D'Aprano
On Sun, 28 Dec 2008 06:58:18 +, Steven D'Aprano wrote: > def make_decimal(f, precision=16): > # choose how many decimal places you want to keep return > Decimal.from_float(f, precision) Ah crap, I forgot that from_float() has been left out of the decimal API. That's very annoying. S

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>>> As others already said, using a Numpy array or an array.array object >>> would >>> be more efficient (and even easier - the C code gets a pointer to an >>> array >>> of integers, as usual). >> >> I looked for this in the C API docs but couldn't find anything on how >> to make an array.array pyt