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


Groups > comp.lang.python > #100218

Re: How to use internal python c funtions, from python code

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: How to use internal python c funtions, from python code
Date Thu, 10 Dec 2015 15:53:48 +1100
Lines 15
Message-ID <mailman.105.1449723237.12405.python-list@python.org> (permalink)
References <CACs7g=DG2Ns8EER5iULogGmGLcny6_JyctYF_W_OdNZtjn3UCQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de LJcjXtvh2wuly6n2ck8NcgkBJye6t8+JRn1LQSZmLQeQ==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:code': 0.07; 'cc:addr:python-list': 0.09; 'subject:How': 0.09; 'subject:python': 0.14; 'thu,': 0.15; 'available;': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'string': 0.17; 'integer': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'purposes': 0.20; 'programming': 0.22; 'dec': 0.23; 'header:In-Reply-To:1': 0.24; 'example': 0.26; 'message-id:@mail.gmail.com': 0.27; 'converting': 0.27; 'base,': 0.29; 'code': 0.30; 'options': 0.33; 'running': 0.34; 'received:google.com': 0.35; 'subject:use': 0.35; 'quite': 0.35; 'but': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'subject:from': 0.39; 'your': 0.60; 'competitive': 0.61; 'making': 0.62; 'obvious': 0.76; 'chrisa': 0.84; 'to:none': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=ztWQK2Y+k8XWQ6/ouNb5oKbU9Xysr1yVilz+16nkIaM=; b=HclEETTzFkwL5Vcg05cfaUIL5dnWWovGUAdaNczLh6hYHCMW0xOsU64unNuwVggUOs +QaZ4LCK6IsmkenMWVa18Y7KclXsH3WIG6mIi9iOx5rtpaAYr9VUw5xmnRbGxSDK6LJ+ hVm074ypxV09PcSZIkMlgRr7jOja/yknc16/NuxonEkEXKRgDWzLN7IwAcFPY5dKpOrN AR70xFygl9rVcX3M2HM9xrcoPZCjILH7aJ7fRG5741jl2XEtF2DZl+N0hVtlUbbZp+cR JCCuKy1CcM54CZ9thRaAV6O49TlE7gR/oUA5MfKmcFrkce5potpK1bj0tr89/OyD5pHS SbEA==
X-Received by 10.50.61.164 with SMTP id q4mr13384990igr.13.1449723228866; Wed, 09 Dec 2015 20:53:48 -0800 (PST)
In-Reply-To <CACs7g=DG2Ns8EER5iULogGmGLcny6_JyctYF_W_OdNZtjn3UCQ@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:100218

Show key headers only | View raw


On Thu, Dec 10, 2015 at 3:44 PM, srinivas devaki
<mr.eightnoteight@gmail.com> wrote:
> For competitive programming purposes I really want to use those functions
> for speed.

Recommendation: Write your code the simple and obvious way, and *then*
start thinking about speed. And before you look at calling on C code
manually, try running your code in PyPy, and then try making use of
Cython.

For the specific example of converting an integer into a string using
a particular base, there are quite a few options available; but I
would recommend using the very simplest you can get away with.

ChrisA

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


Thread

Re: How to use internal python c funtions, from python code Chris Angelico <rosuav@gmail.com> - 2015-12-10 15:53 +1100

csiph-web