Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43857

Re: equivalent to C pointer

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <abelahcene@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'think,': 0.07; '"__main__":': 0.09; '__name__': 0.09; 'main()': 0.09; 'pointers': 0.09; 'received:209.85.219': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'cheers': 0.12; '###': 0.16; '0.1)': 0.16; 'ideal.': 0.16; 'left,': 0.16; 'main():': 0.16; 'pointers.': 0.16; '{0}': 0.16; 'wrote:': 0.18; '&lt;': 0.19; 'thu,': 0.19; 'import': 0.22; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'math': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'define': 0.26; 'task': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'file': 0.32; 'alone': 0.33; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'received:209': 0.37; 'step': 0.37; 'skip:& 10': 0.38; 'pm,': 0.38; 'skip:& 20': 0.39; 'does': 0.39; '\xa0\xa0\xa0': 0.39; 'sure': 0.39; 'skip:u 10': 0.60; 'save': 0.62; 'to:addr:gmail.com': 0.65; 'power': 0.76; 'lot,': 0.93; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=X6ZPzMrScmkgSMJoAvXv9fp6xq30owL62f+m2mda54Y=; b=vNmmj+GF6yaexYZjGeMBgSWJiDz5vduIgeIZDcJZ1gCeXX8oiGYExZWRiWD6Vrem1x GxWhAvVUS2Rh2lRI2Klrwn7TV1dyqXDyFc/CURpyWd1Yz+xcPxv9fGX3mO5K5ffS7U4z JqOB+GCvb9qdE3umkNdWm5xOARPCB2Up9qEYgHjaXq4Rh3dS9QlqKdjbLjJgB0RCSXMh MTvTw4XEcceWoZuMPcmRaa75FA/K/nCadodiC/D8asg8Tc5HTRbYapNKGUMGNjRaEXjc ab0lNij93g4lT6/X9QY3LPweYqaJfQodt+AL6Epd+nOqwVHkwIIgKDT2o0uyg5yL7e8k FgGg==
MIME-Version 1.0
X-Received by 10.60.19.101 with SMTP id d5mr6025211oee.115.1366314898878; Thu, 18 Apr 2013 12:54:58 -0700 (PDT)
In-Reply-To <CAF3Xjby+U2Q6XTVRk+iSW_6xCdyJuabgrWrxZ5+7wDAWqGvR8A@mail.gmail.com>
References <CAF3f0sQ_rsdKwaEOCmFHEeEwpVUaNUo-pOYgoqYA_F-k0CftcA@mail.gmail.com> <51702AB6.30609@gmail.com> <CAF3f0sTgxWupYqKDdtqqaPBz2kCZ04404rtDBnsOkDLXAfbQpQ@mail.gmail.com> <CAF3Xjby+U2Q6XTVRk+iSW_6xCdyJuabgrWrxZ5+7wDAWqGvR8A@mail.gmail.com>
Date Thu, 18 Apr 2013 20:54:58 +0100
Subject Re: equivalent to C pointer
From abdelkader belahcene <abelahcene@gmail.com>
To David Robinow <drobinow@gmail.com>
Content-Type multipart/alternative; boundary=e89a8fb1ff1833453d04daa7fa95
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.792.1366314902.3114.python-list@python.org> (permalink)
Lines 110
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1366314902 news.xs4all.nl 2187 [2001:888:2000:d::a6]:60022
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43857

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Thanks a lot, I think this does the task

cheers


On Thu, Apr 18, 2013 at 7:14 PM, David Robinow <drobinow@gmail.com> wrote:

> On Thu, Apr 18, 2013 at 1:50 PM, abdelkader belahcene <
> abelahcene@gmail.com> wrote:
>
>> Thanks for answer,
>> but with C  we can compile the trapeze function and put it in librairy,
>> If we try to save the trapeze alone in  package to import it later,  I
>> think, I am not sure
>> it will be refused because F1 and sin are not define !!!     this is the
>> power of the C pointers !!!
>> the link is dynamic
>>
> You don't need C pointers.  The design below is demonstrative, not ideal.
>
> # file  MyFuncs.py
>
> def F1(x):
>     return x*x
>
> def Trapeze(f, left, right, step):
>     X0 = left
>     Z = 0.0
>     while (X0 < right):
>         X1 = X0 + step
>         Y1 = f(X1)
>         Y0 = f(X0)
>
>         Z += (Y1 + Y0) * step * 0.5
>         X0 = X1
>     return Z
>
>
>
> # file UseMyFuncs.py
> import math
> import MyFuncs
>
> def main():
>     y = MyFuncs.Trapeze(math.sin, -2.5, 3.2, 0.1)
>
>     print("Value for sin is:{0} ".format(y))
>     y = MyFuncs.Trapeze(MyFuncs.F1, 0, 3, 0.1)
>
>     print("Value for F1 is {0} ".format(y))
>
> if __name__ == "__main__":
>     main()
>
> ###
> #python3 UseMyFuncs.py
> ###
>
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: equivalent to C pointer abdelkader belahcene <abelahcene@gmail.com> - 2013-04-18 20:54 +0100

csiph-web