Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #69254
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'error:': 0.07; '#include': 0.09; '(first': 0.09; 'identifier': 0.09; 'if,': 0.09; 'main()': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject: [': 0.09; 'subject:language': 0.09; 'yeah,': 0.09; 'afaik.': 0.16; 'c++)': 0.16; 'check?': 0.16; 'for,': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'wrote:': 0.18; 'variable': 0.18; '>>>': 0.22; 'appears': 0.22; '(in': 0.22; 'header:User- Agent:1': 0.23; 'certain': 0.27; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'gcc': 0.31; 'fri,': 0.33; 'guess': 0.33; 'but': 0.35; 'expected': 0.38; 'ends': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'reported': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'dave': 0.60; 'expression': 0.60; 'new': 0.61; 'fire': 0.65; 'note:': 0.66; 'mar': 0.68; 'subject:NOT': 0.84; 'angel': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: Python language hack for C-style programmers [DO NOT USE!] :-) |
| Date | Fri, 28 Mar 2014 08:46:29 +0100 |
| Organization | None |
| References | <20140327110856.14991bb0@bigbox.christie.dr> <CAPTjJmoSEiBEO9fXfwM7mGywty+dT8erBqeu2mpyrxAf12udcw@mail.gmail.com> <lh2jsg$cqu$1@ger.gmane.org> <CAPTjJmoU-Aa_Y2DDHzCyzMNUfNnuV2i2gsHWZP3gKBhzrXjLzw@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| X-Gmane-NNTP-Posting-Host | p57bd9041.dip0.t-ipconnect.de |
| User-Agent | KNode/4.11.5 |
| 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.8658.1395992809.18130.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1395992809 news.xs4all.nl 2877 [2001:888:2000:d::a6]:44086 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:69254 |
Show key headers only | View raw
Chris Angelico wrote:
> On Fri, Mar 28, 2014 at 12:44 PM, Dave Angel <davea@davea.name> wrote:
>>> if (array m = Regexp.split2(some_pattern, some_string))
>>> do_something(m);
>>>
>>
>> I don't know for certain about if, but you can declare (in C++) a
>> new variable in for, which is a superset of if. Scope ends when
>> the for does.
>
> Yeah, but only a for, AFAIK. Not an if or a while.
Why would you guess if you can check? Just fire up the interactive
interpreter^W^W compiler:
$ cat ifdecl.c
#include <stdio.h>
int main()
{
if(int i=42)
printf("%d\n", i);
}
$ gcc ifdecl.c
ifdecl.c: In function ‘main’:
ifdecl.c:5:6: error: expected expression before ‘int’
if(int i=42)
^
ifdecl.c:6:20: error: ‘i’ undeclared (first use in this function)
printf("%d\n", i);
^
ifdecl.c:6:20: note: each undeclared identifier is reported only once for
each function it appears in
$ g++ ifdecl.c
$ ./a.out
42
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python language hack for C-style programmers [DO NOT USE!] :-) Peter Otten <__peter__@web.de> - 2014-03-28 08:46 +0100
csiph-web