Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34099
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!rt.uk.eu.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'main()': 0.07; 'anyway': 0.11; 'dec': 0.15; 'sat,': 0.15; '"int': 0.16; 'earlier.': 0.16; 'foo;': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'guilty': 0.16; 'wrote:': 0.17; 'module': 0.19; 'bit': 0.21; 'fine,': 0.22; 'void': 0.22; 'defined': 0.22; 'this:': 0.23; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'function': 0.30; 'stuff': 0.30; 'code': 0.31; 'int': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'same.': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'different': 0.63; 'andrea': 0.84; 'suprise': 0.84 |
| 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=J2vvvHcGHIalJdo1bFGFjWBl4/j9qxWoKEfYf2tj8vc=; b=ONbMUrqYL0UQZr2yutR5YxruegH9CXdbYZtStkjVDz+mFVfKvHf/j6VPVwbDAhmEdQ 0IeQK+amNh0jGZSYWT0EpR6Yom4H6HiXEThz5/+MRPBybu2l6uNLiJvFoVcsbtvY7Mv9 2FwiuMWVWOwAwufZl7uLGl5Z+cOwE4z3ZqOFdr1VLW8r2xTC1ZyoAtAdDoumcz+RHRnF /4B5QrVme9m65EXaCIz7A3pqOmJGJgFJ2hRXE/dPXMonwG68vOTSDZzaSNxEHhrLl4LW uQckQ6jC1kcyyMEDfl6XipGf2sEneCeGpPiHCq4bMjlOMZhUXdyWp4nNHCHYDRFl568f EIdg== |
| MIME-Version | 1.0 |
| In-Reply-To | <CAF_E5JbeoJ__WTMy-omFPrWP23E=yyeEJ8ABaEJ5jaFP9vFbPw@mail.gmail.com> |
| References | <mailman.380.1354273891.29569.python-list@python.org> <thhmo9-ie6.ln1@satorlaser.homedns.org> <CAF_E5JbeoJ__WTMy-omFPrWP23E=yyeEJ8ABaEJ5jaFP9vFbPw@mail.gmail.com> |
| Date | Sat, 1 Dec 2012 03:08:45 +1100 |
| Subject | Re: amazing scope? |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.385.1354291733.29569.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1354291733 news.xs4all.nl 6902 [2001:888:2000:d::a6]:34488 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:34099 |
Show key headers only | View raw
On Sat, Dec 1, 2012 at 3:05 AM, andrea crotti <andrea.crotti.0@gmail.com> wrote:
> Well I knew that this works fine, even if I feel a bit guilty to do
> this, and better is:
>
> foo = 'bar' if some_condition else 'baz'
>
> Anyway for me the suprise is that something that is defined *later* at
> the module scope is found in a function which is defined *earlier*.
It's assigned to earlier. It's no different from C code like this:
int foo;
void blah()
{
/* do stuff with foo */
}
int main()
{
foo = 1;
}
In Python, the "int foo;" is implicit, but the scope is the same.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
amazing scope? andrea crotti <andrea.crotti.0@gmail.com> - 2012-11-30 11:11 +0000
Re: amazing scope? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-30 12:23 +0100
Re: amazing scope? andrea crotti <andrea.crotti.0@gmail.com> - 2012-11-30 16:05 +0000
Re: amazing scope? Chris Angelico <rosuav@gmail.com> - 2012-12-01 03:08 +1100
Re: amazing scope? Dave Angel <d@davea.name> - 2012-11-30 17:57 -0500
csiph-web