Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57750
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <kwpolska@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.007 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'output': 0.05; 'subject:Python': 0.06; 'utf-8': 0.07; 'spaces': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '(same': 0.16; 'be:': 0.16; 'block.': 0.16; 'indent': 0.16; 'semicolon': 0.16; 'think.': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'bit': 0.19; 'file,': 0.19; 'command': 0.22; 'rules': 0.22; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'instance,': 0.24; 'looks': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'chris': 0.29; 'dos': 0.30; 'errors': 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; '(which': 0.31; 'code': 0.31; 'supposed': 0.32; 'running': 0.33; 'sense': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'wrong': 0.37; 'so,': 0.37; 'window': 0.38; 'pm,': 0.38; 'anything': 0.39; 'called': 0.40; 'most': 0.60; 'from:charset:utf-8': 0.61; 'first': 0.61; 'skip:\xe2 10': 0.65; 'to:addr:gmail.com': 0.65; '8bit%:43': 0.74; 'it\xe2\x80\x99s': 0.84; 'urge': 0.91; 'works!': 0.91; 'url:tk': 0.95; '2013': 0.98 |
| 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 :cc:content-type:content-transfer-encoding; bh=54JPcXMdyUmZSIh5UTnsR+qdfUqFBWqVYZKG8TdxLaI=; b=fKIvGdoKMFJy+x2ZN6vIWJb+VmJTIKoZeGgX6Gd/4mFUKMwVjVCzADFhh+l0z3UGro sngwRQ0BCTJbrP8tCPdBXFqFn0VrKMa+7iXNwSSc2QbxbnHLPPjxEt8Wgs5zSekecVwa QxFz/d72jK5Hh5Nlsr4Q+xu9IvLnPDRzUTll5e5E/qkhguG6zJePLEnEnM+SvFErrcui vsgaGTRGWGcaTYDH+wbiJc7oHU9fAtL1ETLpgFDqPqsAb7HySg1SIIs8t5T/thHqKhs1 x1ZYWhka779KDwEOR7iZ/ON1baYNFufRClCKFpkES5gC7v7GxKb3AZCo0PVtsqAx8am3 8iXA== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.114.168 with SMTP id jh8mr5526258igb.6.1382888438890; Sun, 27 Oct 2013 08:40:38 -0700 (PDT) |
| In-Reply-To | <96fc985d-725e-4fe7-8d30-0bcaad91f975@googlegroups.com> |
| References | <96fc985d-725e-4fe7-8d30-0bcaad91f975@googlegroups.com> |
| Date | Sun, 27 Oct 2013 16:40:38 +0100 |
| Subject | Re: indentation blocking in Python |
| From | Chris “Kwpolska” Warrick <kwpolska@gmail.com> |
| To | ajetrumpet@gmail.com |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| 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 | <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.1652.1382890138.18130.python-list@python.org> (permalink) |
| Lines | 42 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1382890138 news.xs4all.nl 15980 [2001:888:2000:d::a6]:40083 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:57750 |
Show key headers only | View raw
On Sun, Oct 27, 2013 at 4:31 PM, <ajetrumpet@gmail.com> wrote:
> hello all,
>
> This has got me a tad bit confused I think. I am running 3.3.0 and I know that Python looks to group code together that is supposed to be in the same block. But the question is, where are the rules for this? For instance, if I type the following in a PY file, it errors out and I don't see the DOS window with the output in Vista:
It’s called the command prompt.
> a=1;
> if a==1: print(1)
> else: print(0)
> wait = input("press key")
>
> However, if I don't indent anything at all, it works!
>
> a=1;
> if a==1: print(1)
> else: print(0)
> wait = input("press key")
You indented the wrong thing. You put your if/else statement in a
non-standard way (which works, but is discouraged). Also, you ended
the first line with a semicolon (same case). So, the proper code
would be:
a=1
if a==1:
print(1)
else:
print(0)
wait = input("press key")
(I resisted the urge to add spaces around `=` and `==`, something most
people want you to do.)
--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
indentation blocking in Python ajetrumpet@gmail.com - 2013-10-27 08:31 -0700 Re: indentation blocking in Python "Colin J. Williams" <cjw@ncf.ca> - 2013-10-27 11:37 -0400 Re: indentation blocking in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-27 15:44 +0000 Re: indentation blocking in Python Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-10-27 16:40 +0100
csiph-web