Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43844
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'everybody,': 0.07; 'think,': 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; '<': 0.19; 'thu,': 0.19; 'example': 0.22; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'compilation': 0.24; 'pointer': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'define': 0.26; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'alone': 0.33; '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; 'skip:& 10': 0.38; 'pm,': 0.38; '\xa0\xa0\xa0': 0.39; 'sure': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'new': 0.61; 'save': 0.62; 'such': 0.63; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'power': 0.76; 'use\xa0': 0.84; 'discovering': 0.91; 'notion': 0.91; '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=tM7bGkMhi6UeqGDbWdknO0bkrL2W1RHtko0CO1ANjNM=; b=aNPe84LsDs/qyLvbXQhOEYGTmB2MyZfU9wuIQy3/EbQknfqW0iYzm0xkO7yRl8EtrV HAeBHUaznN8Xx5B66vQQa6oLqiBQy0cix44cFhUSNnZpafTjHnfe8ofD9YLQvyGRHFeO ajXnaALln8z6n6KEdatg+jpXjOqXWtSPkjme8M/6JM+VKsKnkYN7hoziTak8dO5vmwef 7pJO9zTq3osXL9rsNpgmthDjOFDtwMIJ2XfTK/vIRml3gjIw6v+Zbx85tR1mI8NKr0x7 HA6r7bC4lPhgssCxjHxX60ra+IDYN1QZKK3DVvXScKdIYHgKfgXfVqMKoI9zSUgRP0E4 zAuA== |
| MIME-Version | 1.0 |
| X-Received | by 10.182.125.132 with SMTP id mq4mr6034088obb.79.1366307400197; Thu, 18 Apr 2013 10:50:00 -0700 (PDT) |
| In-Reply-To | <51702AB6.30609@gmail.com> |
| References | <CAF3f0sQ_rsdKwaEOCmFHEeEwpVUaNUo-pOYgoqYA_F-k0CftcA@mail.gmail.com> <51702AB6.30609@gmail.com> |
| Date | Thu, 18 Apr 2013 18:50:00 +0100 |
| Subject | Re: equivalent to C pointer |
| From | abdelkader belahcene <abelahcene@gmail.com> |
| To | Karim <kliateni@gmail.com> |
| Content-Type | multipart/alternative; boundary=089e013a1ede3e306804daa63bac |
| 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.783.1366307409.3114.python-list@python.org> (permalink) |
| Lines | 214 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1366307409 news.xs4all.nl 2230 [2001:888:2000:d::a6]:46258 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:43844 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
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
thanks
On Thu, Apr 18, 2013 at 6:17 PM, Karim <kliateni@gmail.com> wrote:
>
> 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 — Next in thread | Find similar | Unroll thread
Re: equivalent to C pointer abdelkader belahcene <abelahcene@gmail.com> - 2013-04-18 18:50 +0100
Re: equivalent to C pointer Neil Cerutti <neilc@norwich.edu> - 2013-04-18 18:07 +0000
Re: equivalent to C pointer Tim Chase <python.list@tim.thechases.com> - 2013-04-18 13:48 -0500
csiph-web