bigint <-> python long

Russel Winder russel at winder.org.uk
Thu Sep 6 00:07:03 PDT 2012


Sorry, I missed earlier bits of this thread…

On Wed, 2012-09-05 at 19:37 -0700, Ellery Newcomer wrote:
> On 09/05/2012 07:10 PM, bearophile wrote:
> >
> > Some D lazy ranges <==> Python lazy iterators/generators
> >
> 
> I'll look into this one.
> 
> > array.array <==> D arrays
> 
> just checked, looks like we have it:
> 
> PyStmts(q"{from array import array; a = array('i', [44,33,22,11]);}", 
> "testing");
> assert(PyEval!(int[])("a", "testing") == [44,33,22,11]);
> 
> I think if the python object is iterable, it can be converted to array.

I am guessing this is interfacing to CPython, remember there is also
PyPy and ActiveState, they have different ways of doing things.  Well
the ActiveState C API will be very close to the CPython C API, but PyPy
(which is the best Python 2.7 just now) doesn't have a C API since it is
written in RPython. 

> Matrices might pose a problem. But user can define custom conversions if 
> need be.
> 
> >
> > NumPy arrays <==> D arrays
> >
> 
> I have never used NumPy. Are its arrays special?

Oh yes.

NumPy is basically a subsystem that Python applications make calls into.
Although the data structure can be accessed and amended, algorithms on
the data structures should never be written in Python, they should
always be function calls into the NumPy framework.

> >
> >> Also, which of the following looks more appealing to you?
> >
> > I don't know.
> >
> 
> ok, I'll be lazy then.
> 

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20120906/c71e74c8/attachment.pgp>


More information about the Digitalmars-d-learn mailing list