Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #94096
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.013 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'binary': 0.05; 'prefix': 0.07; 'exception:': 0.09; 'python': 0.10; 'syntax': 0.13; '0o,': 0.16; ':-p': 0.16; 'hex': 0.16; 'literal,': 0.16; 'literal.': 0.16; 'literals': 0.16; 'literals,': 0.16; 'literals.': 0.16; 'octal': 0.16; 'zeroes': 0.16; 'wrote:': 0.16; 'obviously': 0.16; 'integer': 0.18; '2015': 0.20; 'sat,': 0.23; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'error': 0.27; 'message- id:@mail.gmail.com': 0.27; 'error.': 0.31; 'anyone': 0.32; "d'aprano": 0.33; 'int': 0.33; 'raised': 0.33; 'steven': 0.33; 'similar': 0.33; 'received:google.com': 0.35; 'but': 0.36; 'should': 0.36; 'instead': 0.36; 'there': 0.36; 'to:addr:python- list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'itself': 0.38; 'why': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'leading': 0.61; 'legal': 0.66; 'prohibited': 0.70; 'jul': 0.72; '010': 0.84; 'confusing': 0.84; 'consequently': 0.84; 'subject:leading': 0.84; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Bahy9S1M10kuwfTJsK010WSEWITGQBgrjMpnf2lAA4w=; b=JFDQVYVIeFgEgRA7h+x4fKOVKGlRy8gZHmf0iCWhuzSGaRj5DhIrsdrxuVqpmlLgwr szBOicebxSQJslqGT/I8lEdbAOlNNoSV2JE+0mA9Oxnv3TBWocBbhxU+j8NZFCj2D3lK or4nPRrlNJbCwhPLtKo/McHZMvwdM7rHCqymEOII1bNZutYUzPML9+1DvUak4zF9lUIg X1RV6gQ6GfgHVho6fclalw+00rfD+Z5CLqtXHK9f/WsbssOGk2HEEEYewPjqpSVAEr4i ara1jfV2+gg4FpxniPUU7bd4Tr6hXcXiAswm5dxtczKqFGFobtb1nzmjI2+vff36ofne grLA== |
| X-Received | by 10.170.141.4 with SMTP id i4mr22845664ykc.32.1437284808007; Sat, 18 Jul 2015 22:46:48 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <55ab37fb$0$1661$c3e8da3$5496439d@news.astraweb.com> |
| References | <55ab37fb$0$1661$c3e8da3$5496439d@news.astraweb.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Sat, 18 Jul 2015 23:46:08 -0600 |
| Subject | Re: Integers with leading zeroes |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.699.1437284811.3674.python-list@python.org> (permalink) |
| Lines | 18 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1437284811 news.xs4all.nl 2835 [2001:888:2000:d::a6]:38027 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:94096 |
Show key headers only | View raw
On Sat, Jul 18, 2015 at 11:39 PM, Steven D'Aprano <steve@pearwood.info> wrote: > In Python 2, integer literals with leading zeroes are treated as octal, so > 09 is a syntax error and 010 is 8. > > This is confusing to those not raised on C-style octal literals, so in > Python 3 leading zeroes are prohibited in int literals. Octal is instead > written using the prefix 0o, similar to hex 0x and binary 0b. > > Consequently Python 3 makes both 09 and 010 a syntax error. > > However there is one exception: zero itself is allowed any number of leading > zeroes, so 00000 is a legal way to write zero as a base-10 int literal. It's obviously a base-8 literal, not a base-10 literal. :-P > Does anyone use that (mis)feature? I don't, but why should it matter?
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Integers with leading zeroes Steven D'Aprano <steve@pearwood.info> - 2015-07-19 15:39 +1000
Re: Integers with leading zeroes Ian Kelly <ian.g.kelly@gmail.com> - 2015-07-18 23:46 -0600
Re: Integers with leading zeroes "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-07-19 10:19 +0200
Re: Integers with leading zeroes Rick Johnson <rantingrickjohnson@gmail.com> - 2015-07-19 12:58 -0700
Re: Integers with leading zeroes Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-21 19:21 +0200
Re: Integers with leading zeroes sohcahtoa82@gmail.com - 2015-07-21 10:58 -0700
Re: Integers with leading zeroes Emile van Sebille <emile@fenx.com> - 2015-07-21 11:06 -0700
Re: Integers with leading zeroes sohcahtoa82@gmail.com - 2015-07-21 11:38 -0700
Re: Integers with leading zeroes sohcahtoa82@gmail.com - 2015-07-21 11:41 -0700
Re: Integers with leading zeroes Steven D'Aprano <steve@pearwood.info> - 2015-07-22 10:55 +1000
Re: Integers with leading zeroes Chris Angelico <rosuav@gmail.com> - 2015-07-22 11:10 +1000
Re: Integers with leading zeroes Steven D'Aprano <steve@pearwood.info> - 2015-07-22 12:14 +1000
Re: Integers with leading zeroes Chris Angelico <rosuav@gmail.com> - 2015-07-22 14:16 +1000
Re: Integers with leading zeroes Laura Creighton <lac@openend.se> - 2015-07-22 09:12 +0200
Re: Integers with leading zeroes alister <alister.nospam.ware@ntlworld.com> - 2015-07-22 09:09 +0000
Re: Integers with leading zeroes Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-22 17:27 +0200
Re: Integers with leading zeroes Grant Edwards <invalid@invalid.invalid> - 2015-07-22 15:47 +0000
Re: Integers with leading zeroes MRAB <python@mrabarnett.plus.com> - 2015-07-22 16:38 +0100
Re: Integers with leading zeroes Grant Edwards <invalid@invalid.invalid> - 2015-07-22 15:50 +0000
Re: Integers with leading zeroes MRAB <python@mrabarnett.plus.com> - 2015-07-22 17:24 +0100
Re: Integers with leading zeroes Chris Angelico <rosuav@gmail.com> - 2015-07-23 08:32 +1000
Re: Integers with leading zeroes Laura Creighton <lac@openend.se> - 2015-07-22 09:31 +0200
Re: Integers with leading zeroes Ben Finney <ben+python@benfinney.id.au> - 2015-07-22 18:40 +1000
Re: Integers with leading zeroes Marko Rauhamaa <marko@pacujo.net> - 2015-07-22 12:10 +0300
Re: Integers with leading zeroes Laura Creighton <lac@openend.se> - 2015-07-22 11:38 +0200
Re: Integers with leading zeroes Marko Rauhamaa <marko@pacujo.net> - 2015-07-22 13:26 +0300
Re: Integers with leading zeroes Grant Edwards <invalid@invalid.invalid> - 2015-07-22 13:51 +0000
Re: Integers with leading zeroes Rustom Mody <rustompmody@gmail.com> - 2015-07-22 07:03 -0700
Re: Integers with leading zeroes Steven D'Aprano <steve@pearwood.info> - 2015-07-23 01:14 +1000
Re: Integers with leading zeroes Grant Edwards <invalid@invalid.invalid> - 2015-07-22 15:20 +0000
Re: Integers with leading zeroes Michael Torrie <torriem@gmail.com> - 2015-07-22 20:11 -0600
Re: Integers with leading zeroes Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-07-24 18:23 +1200
Re: Integers with leading zeroes Chris Angelico <rosuav@gmail.com> - 2015-07-24 16:28 +1000
Re: Integers with leading zeroes alister <alister.nospam.ware@ntlworld.com> - 2015-07-24 13:16 +0000
csiph-web