Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64520
| Path | csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <larry.martell@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; 'static': 0.04; 'output': 0.05; '22,': 0.09; 'args)': 0.09; 'overflow': 0.09; 'python:': 0.09; 'python': 0.11; 'jan': 0.12; '11:09': 0.16; 'int64': 0.16; 'internally': 0.16; 'overflow.': 0.16; 'url:peps': 0.16; 'values?': 0.16; 'language': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'example': 0.22; 'programming': 0.22; 'to:name:python- list@python.org': 0.22; 'url:dev': 0.24; 'question': 0.24; 'certain': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'void': 0.31; 'url:python': 0.33; '(e.g.': 0.33; 'something': 0.35; 'good.': 0.35; 'received:google.com': 0.35; 'everyone.': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'thank': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'simple': 0.61; 'first': 0.61; 'skip:1 20': 0.65; 'here': 0.66; 'exceed': 0.68; 'philip': 0.95 |
| 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:to :content-type; bh=m9PvAuOqKSSRD1FVo+Nla2lJ7exFqjoLEtEMnbyXsrg=; b=ITzvdwJv34XdIOgPyobZMwgo6SPD8kUVF56mBWTP5JyVsK1gXpLUWrdwx2gSJ8kuPM PIlOIS1qVG++94eAR2K+tva2JP75d0JPioD02DgLBJqoJd+8PohhyEaiuIkyaDfxV9aN o9Eslk8p8pCMQXqyVRNKjY/4f3BurOuhaLRJnWlGmb2wWpTmNM37zhuT3l6/zNjDfy2T X1M42HQIuyF0ctK3C+3F1LjLPvigi1hqlRObfcXcIJzWimCPrE6MLlU/+QW60E0NQDT/ lsDmFk0PVeh4WmRoAuJ/WlyVehFU+aznLnK7cOWIMArPouyDEeWvs+zGDOVHjGSpDQkE oNBw== |
| MIME-Version | 1.0 |
| X-Received | by 10.58.200.168 with SMTP id jt8mr1892148vec.30.1390414735791; Wed, 22 Jan 2014 10:18:55 -0800 (PST) |
| In-Reply-To | <dd6a72bf-b1c4-4868-9cfe-76dfac8b8787@googlegroups.com> |
| References | <dd6a72bf-b1c4-4868-9cfe-76dfac8b8787@googlegroups.com> |
| Date | Wed, 22 Jan 2014 11:18:55 -0700 |
| Subject | Re: No overflow in variables? |
| From | Larry Martell <larry.martell@gmail.com> |
| To | "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.5844.1390415068.18130.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1390415068 news.xs4all.nl 2841 [2001:888:2000:d::a6]:42173 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:64520 |
Show key headers only | View raw
On Wed, Jan 22, 2014 at 11:09 AM, Philip Red
<filippo.biolcati@googlemail.com> wrote:
> Hi everyone. First of all sorry if my english is not good.
> I have a question about something in Python I can not explain:
> in every programming language I know (e.g. C#) if you exceed the max-value of a certain type (e.g. a long-integer) you get an overflow. Here is a simple example in C#:
>
> static void Main(string[] args)
> {
> Int64 x = Int64.MaxValue;
> Console.WriteLine(x); // output: 9223372036854775807
> x = x * 2;
> Console.WriteLine(x); // output: -2 (overflow)
> Console.ReadKey();
> }
>
> Now I do the same with Python:
>
> x = 9223372036854775807
> print(type(x)) # <class 'int'>
> x = x * 2 # 18446744073709551614
> print(x) # <class 'int'>
> print(type(x))
>
> and I get the right output without overflow and the type is always a 'int'.
> How does Python manages internally the types and their values? Where are they stored?
>
> Thank you for your help :)
This may help you understand:
http://www.python.org/dev/peps/pep-0237/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
No overflow in variables? Philip Red <filippo.biolcati@googlemail.com> - 2014-01-22 10:09 -0800
Re: No overflow in variables? Larry Martell <larry.martell@gmail.com> - 2014-01-22 11:18 -0700
Re:No overflow in variables? Dave Angel <davea@davea.name> - 2014-01-22 13:26 -0500
Re: No overflow in variables? Philip Red <filippo.biolcati@googlemail.com> - 2014-01-22 10:32 -0800
Re: No overflow in variables? Chris Angelico <rosuav@gmail.com> - 2014-01-23 05:26 +1100
Re: No overflow in variables? Roy Smith <roy@panix.com> - 2014-01-22 15:55 -0500
Re: No overflow in variables? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-01-23 11:22 +1300
Re: No overflow in variables? Philip Red <filippo.biolcati@googlemail.com> - 2014-01-22 10:48 -0800
Re: No overflow in variables? random832@fastmail.us - 2014-01-22 18:13 -0500
Re: No overflow in variables? Christian Heimes <christian@python.org> - 2014-01-23 10:14 +0100
Re: No overflow in variables? Chris Angelico <rosuav@gmail.com> - 2014-01-23 20:36 +1100
csiph-web