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


Groups > comp.lang.python > #43842

Re: equivalent to C pointer

Path csiph.com!usenet.pasdenom.info!aioe.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 <kliateni@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'everybody,': 0.07; '#include': 0.09; 'closest': 0.09; 'pointers': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'cheers': 0.12; '/**': 0.16; '0.1);': 0.16; '0.5;': 0.16; 'iterators': 0.16; 'left,': 0.16; 'x1,': 0.16; 'y1,': 0.16; 'wrote:': 0.18; '&lt;': 0.19; 'example': 0.22; 'cc:addr:python.org': 0.22; 'header:User- Agent:1': 0.23; 'compilation': 0.24; 'pointer': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'defined': 0.27; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'knows': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'functions.': 0.36; 'method': 0.36; 'thanks': 0.36; 'too': 0.37; 'step': 0.37; 'message-id:@gmail.com': 0.38; 'skip:& 10': 0.38; 'how': 0.40; 'new': 0.61; 'such': 0.63; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'received:192.168.0.3': 0.84; 'discovering': 0.91; 'notion': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type; bh=drUSdx5IKFp9+3W2L9OuwpIrfr8Z/jOmXHHBacCCkqA=; b=FvCq+j2cj4ur6oSBAAyLDWQNILNc+gjaxpNFrdLkVK4MeIS7LcFayX2S/5lNNbxEp+ ZzeFGTtuNBp96WBe+YcuG4YvuOJzUXh4KqAJvaUhR97tWCNIkAZQzgx6SIPj0sO9bSlx whVd7+Syov53ddPLhxdPE99nQzNB1v20MmgGccu42KwSHdZ9PIrMy2cU7G6/AH8ReiTX YM8YCHoTP9TDJzu6Pp3Iul/3cSUrLIYJcNyhRsv0eJYi7MyherHIsKC3JGeeEOqKO7af npBrOQwIzHcUS2tbvEnAkyqShQfFsgbXaLhppfSSPQhJsRht9KHF+9PusGA/WYbcLug1 zYxQ==
X-Received by 10.194.93.133 with SMTP id cu5mr20377088wjb.56.1366305465320; Thu, 18 Apr 2013 10:17:45 -0700 (PDT)
Date Thu, 18 Apr 2013 19:17:42 +0200
From Karim <kliateni@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5
MIME-Version 1.0
To abdelkader belahcene <abelahcene@gmail.com>
Subject Re: equivalent to C pointer
References <CAF3f0sQ_rsdKwaEOCmFHEeEwpVUaNUo-pOYgoqYA_F-k0CftcA@mail.gmail.com>
In-Reply-To <CAF3f0sQ_rsdKwaEOCmFHEeEwpVUaNUo-pOYgoqYA_F-k0CftcA@mail.gmail.com>
Content-Type multipart/alternative; boundary="------------000109070308020305090805"
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.781.1366305472.3114.python-list@python.org> (permalink)
Lines 179
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1366305472 news.xs4all.nl 2312 [2001:888:2000:d::a6]:59294
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43842

Show key headers only | View raw


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

Hello,

There is no such notion in python.
But the closest are iterators and generator functions.

Cheers
Karim

On 18/04/2013 19:06, abdelkader belahcene wrote:
> Hi everybody,
>
> I am new to python  and I am discovering it.
> I know C well,
> and want to know if python knows how to manage Pointers
> like pointer to function  here is a C example how to write it in python
> Intergration with trapeze method
>
> When we write Trapeze   ( at the compilation level) we don't know 
> which functions
> Fonc  to handle.      Here for example we use  sin and a user defined  F1
> The program is attached too
>
> #include <stdio.h>
> #include <math.h>
>
> double F1 (double x){
>         return x*x;
> }
> double Trapeze(double Fonc(double ),
>                                 double left, double right, double step){
>   double X1, X0, Y0, Y1, Z = 0;
>   for(X0=left; X0 < right ; X0 = X0 + step) {
>     X1 = X0 + step;
>     Y1 = Fonc(X1);    Y0 = Fonc(X0);
>     Z  += (Y1 + Y0) * step * 0.5;
>   }
>    return Z;
> }
> int  main(){
>   double y;
>   y=Trapeze(sin, -2.5, 3.2, 0.1);
>   printf("\n\tValue for sin  is : \t %8.3lf ", y);
>   y=Trapeze(F1, 0, 3, 0.1);
>   printf("\n\tValue for F1 is : \t %8.3lf ", y);
>   return 0;
> }
> /**
>     Value for sin  is :         0.197
>     Value for F1 is :          9.005
>     */
> thanks a lot
>
>

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


Thread

Re: equivalent to C pointer Karim <kliateni@gmail.com> - 2013-04-18 19:17 +0200

csiph-web