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


Groups > comp.lang.python > #66533

Re: inheriting a large python code base

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; '16,': 0.03; 'initialize': 0.07; 'subject:code': 0.07; 'way:': 0.09; 'cc:addr:python-list': 0.11; '11:59': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'integer.': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'do.': 0.18; "python's": 0.19; 'seems': 0.21; 'feb': 0.22; 'machine': 0.22; 'python?': 0.22; 'cc:addr:python.org': 0.22; 'integer': 0.24; 'cc:2**0': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'guess': 0.33; 'not.': 0.33; "can't": 0.35; 'no,': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'ram': 0.36; 'possible': 0.36; 'similar': 0.36; 'whatever': 0.38; 'pm,': 0.38; 'rather': 0.38; 'anything': 0.39; 'enough': 0.39; 'conversion': 0.61; 'simply': 0.61; "you'll": 0.62; 'close': 0.67; 'limit': 0.70; 'obvious': 0.74; 'other.': 0.75; 'conversion?': 0.84; 'rita': 0.84; 'subject:base': 0.84; 'to:none': 0.92
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=tDuwjIQoiwkF0Db7/oNeh2AB9zfMO6VOabPsKcGXjp8=; b=dUrR83DPUTX3ogH9phpT3Ew1lNW2Gu6itSLBtoSgnC5XPnvwNKdWspaGfsflMAuGnN huvOOe+VZFcUcgjKDh5dVXaYS+gfEzX7fNN/uAbKhA9s5OOVuym/GBwPVLqb16n9XytR uij16ej+UT78V5wzYvOOM3+JmLLr0RbNRToHwPeDX6ZX6qxKFKVfzkKAB87S3ZF+St3a hB+H+QVAip+V+OaAos+oMGAgkQqDfUTJo8rapN/fiUvIah4902bVsvLX7/RdSEkwXd4S A7Q3652rU6opmWx2Qsuf5w0l8hLjGEf1NRbfozVUO+8gHL1kscDYPEbyKLBh6w7Vxm/d 7ZcA==
MIME-Version 1.0
X-Received by 10.66.102.39 with SMTP id fl7mr20337593pab.43.1392557216218; Sun, 16 Feb 2014 05:26:56 -0800 (PST)
In-Reply-To <CAOF-KfjNcT7B5eGvo=k2oXSuFj0YNJjiDCK9x83V9je88eG1Pg@mail.gmail.com>
References <CAOF-KfiD=UgMg7GHiiPiT47zETJmrkicX4YTrxfh4=T2FSq64Q@mail.gmail.com> <mailman.7028.1392505094.18130.python-list@python.org> <roy-F1B3DF.18150315022014@news.panix.com> <ff79ffd3-7d39-4a55-95c3-ddada5ee4955@googlegroups.com> <CAOF-KfjNcT7B5eGvo=k2oXSuFj0YNJjiDCK9x83V9je88eG1Pg@mail.gmail.com>
Date Mon, 17 Feb 2014 00:26:55 +1100
Subject Re: inheriting a large python code base
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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 <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>
Newsgroups comp.lang.python
Message-ID <mailman.7054.1392557224.18130.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1392557224 news.xs4all.nl 2854 [2001:888:2000:d::a6]:51357
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:66533

Show key headers only | View raw


On Sun, Feb 16, 2014 at 11:59 PM, Rita <rmorgan466@gmail.com> wrote:
> when I do profiling is it possible to find out if I am spending a lot of
> time in type conversion?
> it seems I am not.

I would guess that you don't. But in Python, type conversion is like
any other function call:

value = int("12345")

So you can test for it the same way you would any other.

> Also, is it possible to predeclare a type in python?
> Similar to C: int i=0;
>

No, because in Python, variables/names don't have types - only
objects/values do. You can simply initialize i to 0, in the obvious
way:

i = 0

And if you never put anything but an integer into i, it'll always be
an integer. That's about as close as you'll get to an "integer
variable" like C has. (Python's idea of an integer is rather better
than C's, of course; C's 'int' type is a machine word, so it can't
store values greater than 2**32 or 2**64 or whatever the limit is, but
Python's int can store any integer you have RAM enough to store.)

ChrisA

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


Thread

Re: inheriting a large python code base Cameron Simpson <cs@zip.com.au> - 2014-02-16 09:32 +1100
  Re: inheriting a large python code base Roy Smith <roy@panix.com> - 2014-02-15 18:15 -0500
    Re: inheriting a large python code base Rustom Mody <rustompmody@gmail.com> - 2014-02-15 19:06 -0800
      Re: inheriting a large python code base Rita <rmorgan466@gmail.com> - 2014-02-16 07:59 -0500
      Re: inheriting a large python code base Chris Angelico <rosuav@gmail.com> - 2014-02-17 00:26 +1100

csiph-web